Skip to content

Unexpected default behavior for browsers that don't support required input fields / form validation #319

@ahx

Description

@ahx

rails.js adds a behavior to forms so that these don't get submitted if there is a blank required input field. This results in unexpected behavior for browsers that don't support form validation.

The following demo uses jQuery 1.9.1 and the current rails.js.
Open http://jsfiddle.net/wqWMf/4/ in the current version of Safari (6.0.3) and hit the submit button.

Current behavior: Nothing happens

Expected behavior:
Either a) the form should get submitted although the required field is missing
or b) jquery-ujs should add some default styling to highlight the missing fields.

Everything works as expected with browsers that support form validation.

I think the behavior should either be removed or we should have to opt-in explicitly like we are doing with the data-remote, data-confirm,… attributes.

Living in Railsland we know hot show error-messages coming from the server-side validations in forms. The current behavior breaks this, because the form does not get submitted and no error-messages get rendered.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions