-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add form submit events to several backbone views #2244
Add form submit events to several backbone views #2244
Conversation
73320c3
to
0b9273b
Compare
Thanks! |
var code = e.keyCode || e.which; | ||
if (code === 13) { | ||
this.$el.closest('form').submit(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather find a different solution to this. I believe I've found the issue and we should address it in a separate PR. It's not a backbone issue.
The is that the "Add" buttons from the Tiered calculators, which aren't submit buttons, but their disabled state causes chrome to not submit the form on "Enter". This can probably be better solved by making these buttons an <a class="btn"
instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great. I’m more than happy to remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Converted the button
s into a
nchors. The actual problem was that hitting the enter key added new tiers and that prevents the form from being submitted.
0b9273b
to
d3a7f9a
Compare
@jhawthorn review again, please |
d3a7f9a
to
75b52f3
Compare
In order to be able to submit the payments form with the enter key we wrap the input field in a form and use the form submit event in addition to the click event of the save button.
In order to be able to submit the form with enter key in addition to the click event on the save button we wrap the input field in a form.
Buttons block the surrounding form from being submitted by enter key. Instead the enter key leads to tiers being added. Using anchors instead.
75b52f3
to
6162a54
Compare
Rebased with latest |
Lots of our backbone based table rows do have input fields. Users are used to be able to submit changes by hitting the enter key inside a form field.
This is default browser behaviour and should be supported by all our backbone based table row views.