Skip to content

Commit

Permalink
FIX Check hidden inputs exist to prevent browser alert when submittin…
Browse files Browse the repository at this point in the history
…g form
  • Loading branch information
emteknetnz committed Sep 2, 2020
1 parent d82bb6b commit f5d07aa
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
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 f5d07aa

Please sign in to comment.