diff --git a/code/model/UserDefinedForm.php b/code/model/UserDefinedForm.php index 1c78588..7efb6bf 100755 --- a/code/model/UserDefinedForm.php +++ b/code/model/UserDefinedForm.php @@ -321,6 +321,7 @@ class UserDefinedForm_Controller extends Page_Controller { Requirements::javascript(USERFORMS_DIR . '/thirdparty/jquery-validate/jquery.validate.min.js'); Requirements::add_i18n_javascript(USERFORMS_DIR . '/javascript/lang'); Requirements::javascript(USERFORMS_DIR . '/javascript/UserForm.js'); + Requirements::javascript( USERFORMS_DIR . "/thirdparty/jquery-validate/localization/messages_{$lang}.min.js" ); diff --git a/javascript/UserForm.js b/javascript/UserForm.js index c00e696..0839984 100644 --- a/javascript/UserForm.js +++ b/javascript/UserForm.js @@ -557,12 +557,19 @@ jQuery(function ($) { this.$el = element instanceof jQuery ? element : $(element); + this.$prevButton = this.$el.find('.step-button-prev'); + this.$nextButton = this.$el.find('.step-button-next'); + + // Show the buttons. + this.$prevButton.parent().attr('aria-hidden', false).show(); + this.$nextButton.parent().attr('aria-hidden', false).show(); + // Bind the step navigation event listeners. - this.$el.find('.step-button-prev').on('click', function (e) { + this.$prevButton.on('click', function (e) { e.preventDefault(); self.$el.trigger('userform.action.prev'); }); - this.$el.find('.step-button-next').on('click', function (e) { + this.$nextButton.on('click', function (e) { e.preventDefault(); self.$el.trigger('userform.action.next'); }); @@ -620,6 +627,11 @@ jQuery(function ($) { formActions = null, $userform = $('.userform'); + // If there's no userform, do nothing. + if ($userform.length === 0) { + return; + } + CONSTANTS.ENABLE_LIVE_VALIDATION = $userform.data('livevalidation') !== void 0; CONSTANTS.DISPLAY_ERROR_MESSAGES_AT_TOP = $userform.data('toperrors') !== void 0; CONSTANTS.HIDE_FIELD_LABELS = $userform.data('hidefieldlabels') !== void 0; @@ -674,13 +686,6 @@ jQuery(function ($) { progressBar = new ProgressBar($('#userform-progress')); formActions = new FormActions($('#step-navigation')); - // Hide the form-wide actions on multi-step forms. - // Because JavaScript is enabled we'll use the actions contained - // in the final step's navigation. - if (userform.steps.length > 1) { - userform.$el.children('.Actions').attr('aria-hidden', true).hide(); - } - // Enable jQuery UI datepickers $(document).on('click', 'input.text[data-showcalendar]', function() { var $element = $(this); diff --git a/templates/Includes/UserFormStepNav.ss b/templates/Includes/UserFormStepNav.ss index baa4b13..da66d5e 100644 --- a/templates/Includes/UserFormStepNav.ss +++ b/templates/Includes/UserFormStepNav.ss @@ -1,11 +1,19 @@ -