Skip to content

Commit

Permalink
fix processing true returned by validate method, fix vitalets#155
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalets committed Oct 4, 2013
1 parent b73522b commit 28e1f68
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/editable-form/editable-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
} else {
//convert newline to <br> for more pretty error display
if(msg) {
lines = msg.split("\n");
lines = (''+msg).split('\n');
for (var i = 0; i < lines.length; i++) {
lines[i] = $('<div>').text(lines[i]).html();
}
Expand All @@ -196,11 +196,12 @@ Editableform is linked with one of input types, e.g. 'text', 'select' etc.
e.stopPropagation();
e.preventDefault();

var error,
newValue = this.input.input2value(); //get new value from input
//get new value from input
var newValue = this.input.input2value();

//validation
if (error = this.validate(newValue)) {
// validation: if validate returns truthy value - means error
var error = this.validate(newValue)
if (error) {
this.error(error);
this.showForm();
return;
Expand Down

0 comments on commit 28e1f68

Please sign in to comment.