var Validate = {
/**
* validates that the field has been filled in
*
* @var value {mixed} - value to be checked
* @var paramsObj {Object} - parameters for this particular validation, see below for details
*
* paramsObj properties:
* failureMessage {String} - the message to show when the field fails validation
* (DEFAU开发者_StackOverflowLT: "Can't be empty!")
*/
Presence: function(value, paramsObj){
var paramsObj = paramsObj || {};
var message = paramsObj.failureMessage || "Can't be empty!";
if(value === '' || value === null || value === undefined){
Validate.fail(message);
}
return true;
},
actually i tried to change paramobj in here what i wrote is
try{
Validate.Presence(true,{ failureMessage: "You must be true!" })
}catch(err){
alert(err.description);
}
why is it return alert undefined? what cause the error?
Try using:
alert(err.message);
精彩评论