Skip to content

Commit

Permalink
Fix #137 (number input validation)
Browse files Browse the repository at this point in the history
  • Loading branch information
icebob committed Mar 1, 2017
1 parent 736a646 commit 22ac59e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dev/full/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
formOptions: {
validateAfterLoad: true,
validateAfterChanged: false,
validateAfterChanged: true,
validateBeforeSave: true
}
}
Expand Down
3 changes: 2 additions & 1 deletion dev/full/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ module.exports = {
inputType: "number",
label: "Number",
model: "age",
styleClasses: "half-width"
styleClasses: "half-width",
validator: validators.number
}, {
type: "input",
inputType: "range",
Expand Down
3 changes: 2 additions & 1 deletion src/fields/core/fieldInput.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
:type="schema.inputType",
:value="value",
@input="value = $event.target.value",
number="schema.inputType == 'number'",
:disabled="disabled",
:accept="schema.accept",
:alt="schema.alt",
Expand Down Expand Up @@ -65,6 +64,8 @@
return fecha.parse(value, "YYYY-MM-DD HH:mm:ss");
case "datetime-local":
return fecha.parse(value, "YYYY-MM-DDTHH:mm:ss");
case "number":
return Number(value);
}
}
Expand Down

0 comments on commit 22ac59e

Please sign in to comment.