dev build

This commit is contained in:
vitalets
2013-10-10 20:42:55 +04:00
parent ad3c8f5c83
commit 7191240c75
10 changed files with 94 additions and 21 deletions

@ -203,9 +203,18 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
//get new value from input
var newValue = this.input.input2value();
// validation: if validate returns truthy value - means error
//validation: if validate returns string or truthy value - means error
//if returns object like {newValue: '...'} => submitted value is reassigned to it
var error = this.validate(newValue);
if (error) {
if ($.type(error) === 'object' && error.newValue !== undefined) {
newValue = error.newValue;
this.input.value2input(newValue);
if(typeof error.msg === 'string') {
this.error(error.msg);
this.showForm();
return;
}
} else if (error) {
this.error(error);
this.showForm();
return;
@ -504,6 +513,8 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
send: 'auto',
/**
Function for client-side validation. If returns string - means validation not passed and string showed as error.
Since 1.5.1 you can modify submitted value by returning object from `validate`:
`{newValue: '...'}` or `{newValue: '...', msg: '...'}`
@property validate
@type function

File diff suppressed because one or more lines are too long