dev build
This commit is contained in:
dist
src/editable-form
15
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
15
dist/bootstrap-editable/js/bootstrap-editable.js
vendored
@ -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
Reference in New Issue
Block a user