commit d1267da469d89c0a487095695fcfe59dce2e2a7c
Author: Jeremy Moffitt <email address hidden>
Date: Mon May 1 12:28:17 2017 -0700
Prevent "enter" from triggering submit action on modal forms
testable in particular on the containers page, where
the problem was that pressing enter with no container
name would submit the form despite being invalid.
initially tried a more complicated function wrapper
that allowed panels to prevent submit on enter, but
that was overly complicated and only fixed the problem
for panels that are pro-actively changed.
second attempt at fixing the problem was to change
the wrapping element from "form" to "div", which
solved the original problem, but caused a new issue
in that divs aren't validated, so the submit button
was always enabled (since the div was never $invalid)
this fix explicitly checks whether the form is valid
when a submit action occurs, and if it is will
call the uibmodal close action that is what normally
happens when "submit" is pressed. if the form is
invalid, nothing happens.
Reviewed: https:/ /review. openstack. org/461490 /git.openstack. org/cgit/ openstack/ horizon/ commit/ ?id=d1267da469d 89c0a487095695f cfe59dce2e2a7c
Committed: https:/
Submitter: Zuul
Branch: master
commit d1267da469d89c0 a487095695fcfe5 9dce2e2a7c
Author: Jeremy Moffitt <email address hidden>
Date: Mon May 1 12:28:17 2017 -0700
Prevent "enter" from triggering submit action on modal forms
testable in particular on the containers page, where
the problem was that pressing enter with no container
name would submit the form despite being invalid.
initially tried a more complicated function wrapper
that allowed panels to prevent submit on enter, but
that was overly complicated and only fixed the problem
for panels that are pro-actively changed.
second attempt at fixing the problem was to change
the wrapping element from "form" to "div", which
solved the original problem, but caused a new issue
in that divs aren't validated, so the submit button
was always enabled (since the div was never $invalid)
this fix explicitly checks whether the form is valid
when a submit action occurs, and if it is will
call the uibmodal close action that is what normally
happens when "submit" is pressed. if the form is
invalid, nothing happens.
Change-Id: I5071d78b082014 36e50c704fdc20b 6e4a19aee49
Closes-Bug: 1655487