Comment 4 for bug 1655487

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to horizon (master)

Reviewed: https://review.openstack.org/461490
Committed: https://git.openstack.org/cgit/openstack/horizon/commit/?id=d1267da469d89c0a487095695fcfe59dce2e2a7c
Submitter: Zuul
Branch: master

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.

    Change-Id: I5071d78b08201436e50c704fdc20b6e4a19aee49
    Closes-Bug: 1655487