Skip to content

Commit

Permalink
Merge pull request #1000 from creative-commoners/pulls/5.6/submit-error
Browse files Browse the repository at this point in the history
FIX Check hidden inputs exist to prevent browser alert when submitting form
  • Loading branch information
Garion Herman authored Sep 2, 2020
2 parents d82bb6b + f5d07aa commit 1623195
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion client/dist/js/userforms.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions client/src/bundles/UserForms.js
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,10 @@ jQuery(document).ready(($) => {

if (isValid) {
// Remove required attributes on hidden fields
$(form).find('.field.requiredField.hide input')
.removeAttr('required aria-required data-rule-required').valid();
const hiddenInputs = $(form).find('.field.requiredField.hide input');
if (hiddenInputs.length > 0) {
hiddenInputs.removeAttr('required aria-required data-rule-required').valid();
}

// When using the "are you sure?" plugin, ensure the form immediately submits.
$(form).removeClass('dirty');
Expand Down

0 comments on commit 1623195

Please sign in to comment.