powmedia / backbone-forms

Form framework for BackboneJS with nested forms, editable lists and validation
MIT License
2.17k stars 415 forks source link

Submitting the form by pressing "enter" on a Number editor doesn't work #537

Open wojcikstefan opened 7 years ago

wojcikstefan commented 7 years ago

The implementation of editors.Number.onKeyPress is faulty and prevents the form from being submitted by pressing the "enter" key.

Currently, the newline character \r gets appended to newVal in https://github.com/powmedia/backbone-forms/blob/master/src/editors/number.js#L50, which makes the numeric test fail a few lines below, which in turn results in the event.preventDefault(); call.

https://jsfiddle.net/s1h0s5mm/1/