mirror of
https://github.com/silverstripe/silverstripe-userforms.git
synced 2024-10-22 17:05:42 +02:00
1 line
42 KiB
Plaintext
1 line
42 KiB
Plaintext
{"version":3,"sources":["webpack:///webpack/bootstrap a315374ff7245c765b7c","webpack:///./client/src/bundles/UserForms.js","webpack:///external \"i18n\"","webpack:///external \"jQuery\""],"names":["jQuery","document","ready","$","userform","CONSTANTS","commonMixin","show","$el","attr","hide","ErrorContainer","element","find","text","i18n","_t","prototype","hasErrors","children","length","removeErrorMessage","fieldId","remove","addStepLink","step","itemID","$itemElement","stepID","stepTitle","data","on","e","preventDefault","jumpToStep","id","append","removeStepLink","closest","is","updateErrorMessage","$input","message","inputID","anchor","elementID","messageElement","describedBy","addClass","removeClass","html","each","location","pathname","search","match","RegExp","FormStep","self","$elButton","prop","viewed","valid","DISPLAY_ERROR_MESSAGES_AT_TOP","errorContainer","validator","errorList","i","error","trigger","conditionallyHidden","ProgressBar","$buttons","$jsAlign","stepButton","stepNumber","parseInt","target","update","$visibleButtons","filter","button","index","$button","leftPercent","leftPercentCssValue","buttonOffset","innerWidth","css","left","marginLeft","$newStepElement","barWidth","$element","$item","parent","removeAttr","siblings","width","FormActions","$prevButton","$nextButton","numberOfSteps","steps","currentStep","lastStep","UserForm","prevStep","nextStep","validate","validationOptions","a","field","rules","required","ignore","errorClass","errorElement","errorPlacement","parents","appendTo","insertAfter","invalidHandler","event","setTimeout","currentElements","first","focus","submitHandler","form","isValid","submit","success","errorId","substr","indexOf","replace","addStep","push","setCurrentStep","direction","targetStep","forward","main","userformElement","$userform","ENABLE_LIVE_VALIDATION","extend","onfocusout","HIDE_FIELD_LABELS","$label","progressBar","formActions","ssDatepicker","datepicker","setInterval","ajax","url","areYouSure"],"mappings":";AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;AACA;;AAEA;AACA;;AAEA;AACA,mDAA2C,c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Q,8BAAR,EAAwC,2BAAxC;AADK,OAAhB;AAGD;AACF;;AAEDb,IAAE,WAAF,EAAegD,IAAf,CAAoB4F,IAApB;AACD,CA/tBD,E;;;;;;;;;;;;;;;;ACPA,sB;;;;;;ACAA,wB","file":"js/userforms.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// identity function for calling harmony imports with the correct context\n \t__webpack_require__.i = function(value) { return value; };\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap a315374ff7245c765b7c","/**\n * @file Manages the multi-step navigation.\n */\n\nimport jQuery from 'jquery';\nimport i18n from 'i18n';\n\njQuery(document).ready(($) => {\n // A reference to the UserForm instance.\n let userform = null;\n\n // Settings that come from the CMS.\n const CONSTANTS = {};\n\n // Common functions that extend multiple classes.\n const commonMixin = {\n /**\n * @func show\n * @desc Show the form step. Looks after aria attributes too.\n */\n show() {\n this.$el.attr('aria-hidden', false).show();\n },\n /**\n * @func hide\n * @desc Hide the form step. Looks after aria attributes too.\n */\n hide() {\n this.$el.attr('aria-hidden', true).hide();\n },\n };\n\n /**\n * @func ErrorContainer\n * @constructor\n * @param {object} element - The error container element.\n * @return {object} - The ErrorContainer instance.\n * @desc Creates an error container. Used to display step error messages at the top.\n */\n function ErrorContainer(element) {\n this.$el = element instanceof $ ? element : $(element);\n\n // Set the error container's heading.\n this.$el.find('h4').text(i18n._t('UserForms.ERROR_CONTAINER_HEADER',\n 'Please correct the following errors and try again:'));\n\n return this;\n }\n\n /**\n * @func hasErrors\n * @return boolean\n * @desc Checks if the error container has any error messages.\n */\n ErrorContainer.prototype.hasErrors = function hasErrors() {\n return this.$el.find('.error-list').children().length > 0;\n };\n\n /**\n * @func removeErrorMessage\n * @desc Removes an error message from the error container.\n */\n ErrorContainer.prototype.removeErrorMessage = function removeErrorMessage(fieldId) {\n this.$el.find(`#${fieldId}-top-error`).remove();\n\n // If there are no more error then hide the container.\n if (!this.hasErrors()) {\n this.hide();\n }\n };\n\n /**\n * @func addStepLink\n * @param {object} step - FormStep instance.\n * @desc Adds a link to a form step as an error message.\n */\n ErrorContainer.prototype.addStepLink = function addStepLink(step) {\n const itemID = `${step.$el.attr('id')}-error-link`;\n let $itemElement = this.$el.find(`#${itemID}`);\n const stepID = step.$el.attr('id');\n const stepTitle = step.$el.data('title');\n\n // If the item already exists we don't need to do anything.\n if ($itemElement.length) {\n return;\n }\n\n $itemElement = $(`<li id=\"${itemID}\"><a href=\"#${stepID}\">${stepTitle}</a></li>`);\n\n $itemElement.on('click', (e) => {\n e.preventDefault();\n userform.jumpToStep(step.id);\n });\n\n this.$el.find('.error-list').append($itemElement);\n };\n\n /**\n * @func removeStepLink\n * @param {object} step - FormStep instance.\n * @desc Removes a step link from the error container.\n */\n ErrorContainer.prototype.removeStepLink = function removeStepLink(fieldId) {\n const stepID = $(`#${fieldId}`).closest('.form-step').attr('id');\n\n this.$el.find(`#${stepID}-error-link`).remove();\n\n // Hide the error container if we've just removed the last error.\n if (this.$el.find('.error-list').is(':empty')) {\n this.hide();\n }\n };\n\n /**\n * @func ErrorContainer.updateErrorMessage\n * @param {object} $input - The jQuery input object which contains the field to validate.\n * @param {object} message - The error message to display (html escaped).\n * @desc Update an error message (displayed at the top of the form).\n */\n ErrorContainer.prototype.updateErrorMessage = function updateErrorMessage($input, message) {\n const inputID = $input.attr('id');\n let anchor = `#${inputID}`;\n const elementID = `${inputID}-top-error`;\n let messageElement = $(`#${elementID}`);\n let describedBy = $input.attr('aria-describedby');\n\n // The 'message' param will be an empty string if the field is valid.\n if (!message) {\n // Style issues as fixed if they already exist\n messageElement.addClass('fixed');\n return;\n }\n\n messageElement.removeClass('fixed');\n\n this.show();\n\n if (messageElement.length === 1) {\n // Update the existing error message.\n messageElement.show().find('a').html(message);\n } else {\n // Generate better link to field\n $input.closest('.field[id]').each(() => {\n anchor = `#${$(this).attr('id')}`;\n });\n\n // Add a new error message\n messageElement = $('<li><a></a></li>');\n messageElement\n .attr('id', elementID)\n .find('a')\n .attr('href', location.pathname + location.search + anchor)\n .html(message);\n\n this.$el.find('ul').append(messageElement);\n\n // Link back to original input via aria\n // Respect existing non-error aria-describedby\n if (!describedBy) {\n describedBy = elementID;\n } else if (!describedBy.match(new RegExp(`\\\\b${elementID}\\\\b`))) {\n // Add to end of list if not already present\n describedBy += ` ${elementID}`;\n }\n\n $input.attr('aria-describedby', describedBy);\n }\n };\n\n /**\n * @func FormStep\n * @constructor\n * @param {object} element\n * @return {object} - The FormStep instance.\n * @desc Creates a form step.\n */\n function FormStep(element) {\n const self = this;\n\n this.$el = element instanceof $ ? element : $(element);\n\n // Find button for this step\n this.$elButton = $(`.step-button-wrapper[data-for='${this.$el.prop('id')}']`);\n\n // Has the step been viewed by the user?\n this.viewed = false;\n\n // Is the form step valid?\n // This value is used on form submission, which fails, if any of the steps are invalid.\n this.valid = false;\n\n // The internal id of the step. Used for getting the step from the UserForm.steps array.\n this.id = null;\n\n this.hide();\n\n if (CONSTANTS.DISPLAY_ERROR_MESSAGES_AT_TOP) {\n this.errorContainer = new ErrorContainer(this.$el.find('.error-container'));\n\n // Listen for errors on the UserForm.\n userform.$el.on('userform.form.error', (e, validator) => {\n // The step only cares about errors if it's currently visible.\n if (!self.$el.is(':visible')) {\n return;\n }\n\n // Add or update each error in the list.\n $.each(validator.errorList, (i, error) => {\n self.errorContainer.updateErrorMessage($(error.element), error.message);\n });\n });\n\n // Listen for fields becoming valid\n userform.$el.on('userform.form.valid', (e, fieldId) => {\n self.errorContainer.removeErrorMessage(fieldId);\n });\n }\n\n // Ensure that page visibilty updates the step navigation\n this\n .$elButton\n .on('userform.field.hide userform.field.show', () => {\n userform.$el.trigger('userform.form.conditionalstep');\n });\n\n return this;\n }\n\n /**\n * Determine if this step is conditionally disabled\n *\n * @returns {Boolean}\n */\n // Because the element itself could be visible but 0 height, so check visibility of button\n FormStep.prototype.conditionallyHidden = function conditionallyHidden() {\n return !this.$elButton.find('button').is(':visible');\n };\n\n /**\n * @func ProgressBar\n * @constructor\n * @param {object} element\n * @return {object} - The Progress bar instance.\n * @desc Creates a progress bar.\n */\n function ProgressBar(element) {\n const self = this;\n\n this.$el = element instanceof $ ? element : $(element);\n this.$buttons = this.$el.find('.step-button-jump');\n this.$jsAlign = this.$el.find('.js-align');\n\n // Update the progress bar when 'step' buttons are clicked.\n this.$buttons.each((i, stepButton) => {\n $(stepButton).on('click', (e) => {\n e.preventDefault();\n const stepNumber = parseInt($(e.target).data('step'), 10);\n self.$el.trigger('userform.progress.changestep', stepNumber);\n });\n });\n\n // Update the progress bar when 'prev' and 'next' buttons are clicked.\n userform.$el.on('userform.form.changestep', (e, stepID) => {\n self.update(stepID);\n });\n\n // Listen for steps being conditionally shown / hidden by display rules.\n // We need to update step related UI like the number of step buttons\n // and any text that shows the total number of steps.\n userform.$el.on('userform.form.conditionalstep', () => {\n // Update the step numbers on the buttons.\n const $visibleButtons = self.$buttons.filter(':visible');\n\n $visibleButtons.each((i, button) => {\n $(button).text(i + 1);\n });\n\n // Update the actual progress bar.\n self.$el.find('.progress-bar').attr('aria-valuemax', $visibleButtons.length);\n\n // Update any text that uses the total number of steps.\n self.$el.find('.total-step-number').text($visibleButtons.length);\n });\n\n // Spaces out the steps below progress bar evenly\n this.$jsAlign.each((index, button) => {\n const $button = $(button);\n const leftPercent = 100 / (self.$jsAlign.length - 1) * index;\n const leftPercentCssValue = `${leftPercent}%`;\n const buttonOffset = -1 * ($button.innerWidth() / 2);\n\n $button.css({\n left: leftPercentCssValue,\n marginLeft: buttonOffset,\n });\n\n // First and last buttons are kept within userform-progress container\n if (index === self.$jsAlign.length - 1) {\n $button.css({ marginLeft: buttonOffset * 2 });\n } else if (index === 0) {\n $button.css({ marginLeft: 0 });\n }\n });\n\n return this;\n }\n\n /**\n * @func ProgressBar.update\n * @param {number} stepID - Zero based index of the new step.\n * @desc Update the progress element to show a new step.\n */\n ProgressBar.prototype.update = function update(stepID) {\n const $newStepElement = $($('.form-step')[stepID]);\n let stepNumber = 0;\n let barWidth = stepID / (this.$buttons.length - 1) * 100;\n\n // Set the current step number.\n this.$buttons.each((i, button) => {\n if (i > stepID) {\n // Break the loop\n return false;\n }\n\n if ($(button).is(':visible')) {\n stepNumber += 1;\n }\n return true;\n });\n\n // Update elements that contain the current step number.\n this.$el.find('.current-step-number').each((i, element) => {\n $(element).text(stepNumber);\n });\n\n // Update aria attributes.\n this.$el.find('[aria-valuenow]').each((i, element) => {\n $(element).attr('aria-valuenow', stepNumber);\n });\n\n // Update the CSS classes on step buttons.\n this.$buttons.each((i, element) => {\n const $element = $(element);\n const $item = $element.parent();\n\n if (parseInt($element.data('step'), 10) === stepNumber && $element.is(':visible')) {\n $item.addClass('current viewed');\n $element.removeAttr('disabled');\n\n return;\n }\n\n $item.removeClass('current');\n });\n\n // Update the progress bar's title with the new step's title.\n this.$el.siblings('.progress-title').text($newStepElement.data('title'));\n\n // Update the width of the progress bar.\n barWidth = barWidth ? `${barWidth}%` : '';\n this.$el.find('.progress-bar').width(barWidth);\n };\n\n /**\n * @func FormActions\n * @constructor\n * @param {object} element\n * @desc Creates the navigation and actions (Prev, Next, Submit buttons).\n */\n function FormActions(element) {\n const self = this;\n\n this.$el = element instanceof $ ? element : $(element);\n\n this.$prevButton = this.$el.find('.step-button-prev');\n this.$nextButton = this.$el.find('.step-button-next');\n\n // Show the buttons.\n this.$prevButton.parent().attr('aria-hidden', false).show();\n this.$nextButton.parent().attr('aria-hidden', false).show();\n\n // Bind the step navigation event listeners.\n this.$prevButton.on('click', (e) => {\n e.preventDefault();\n self.$el.trigger('userform.action.prev');\n });\n this.$nextButton.on('click', (e) => {\n e.preventDefault();\n self.$el.trigger('userform.action.next');\n });\n\n // Listen for changes to the current form step, or conditional pages,\n // so we can show hide buttons appropriately.\n userform.$el.on('userform.form.changestep userform.form.conditionalstep', () => {\n self.update();\n });\n\n return this;\n }\n\n /**\n * @func FormActions.update\n * @param {number} stepID - Zero based ID of the current step.\n * @desc Updates the form actions element to reflect the current state of the page.\n */\n FormActions.prototype.update = function update() {\n const numberOfSteps = userform.steps.length;\n const stepID = userform.currentStep ? userform.currentStep.id : 0;\n let i = null;\n let lastStep = null;\n\n // Update the \"Prev\" button.\n this.$el.find('.step-button-prev')[stepID === 0 ? 'hide' : 'show']();\n\n // Find last step, skipping hidden ones\n for (i = numberOfSteps - 1; i >= 0; i--) {\n lastStep = userform.steps[i];\n\n // Skip if step is hidden\n if (lastStep.conditionallyHidden()) {\n continue;\n }\n\n // Update the \"Next\" button.\n this.$el.find('.step-button-next')[stepID >= i ? 'hide' : 'show']();\n\n // Update the \"Actions\".\n this.$el.find('.Actions')[stepID >= i ? 'show' : 'hide']();\n\n // Stop processing last step\n break;\n }\n };\n\n /**\n * @func UserForm\n * @constructor\n * @param {object} element\n * @return {object} - The UserForm instance.\n * @desc The form\n */\n function UserForm(element) {\n const self = this;\n\n this.$el = element instanceof $ ? element : $(element);\n this.steps = [];\n\n // Add an error container which displays a list of invalid steps on form submission.\n this.errorContainer = new ErrorContainer(this.$el.children('.error-container'));\n\n // Listen for events triggered by form steps.\n this.$el.on('userform.action.prev', () => {\n self.prevStep();\n });\n this.$el.on('userform.action.next', () => {\n self.nextStep();\n });\n\n // Listen for events triggered by the progress bar.\n $('#userform-progress').on('userform.progress.changestep', (e, stepNumber) => {\n self.jumpToStep(stepNumber - 1);\n });\n\n // When a field becomes valid, remove errors from the error container.\n this.$el.on('userform.form.valid', (e, fieldId) => {\n self.errorContainer.removeStepLink(fieldId);\n });\n\n this.$el.validate(this.validationOptions);\n\n // Ensure checkbox groups are validated correctly\n $('.optionset.requiredField input').each((a, field) => {\n $(field).rules('add', {\n required: true,\n });\n });\n\n return this;\n }\n\n /*\n * Default options for step validation. These get extended in main().\n */\n UserForm.prototype.validationOptions = {\n ignore: ':hidden,ul',\n errorClass: 'error',\n errorElement: 'span',\n errorPlacement: (error, element) => {\n error.addClass('message');\n\n if (element.is(':radio') || element.parents('.checkboxset').length > 0) {\n error.appendTo(element.closest('.middleColumn'));\n } else if (element.parents('.checkbox').length > 0) {\n error.appendTo(element.closest('.field'));\n } else {\n error.insertAfter(element);\n }\n },\n invalidHandler: (event, validator) => {\n // setTimeout 0 so it runs after errorPlacement\n setTimeout(() => {\n validator.currentElements.filter('.error').first().focus();\n }, 0);\n },\n // Callback for handling the actual submit when the form is valid.\n // Submission in the jQuery.validate sence is handled at step level.\n // So when the final step is submitted we have to also check all previous steps are valid.\n submitHandler: (form) => {\n let isValid = true;\n\n // Validate the current step\n if (userform.currentStep) {\n userform.currentStep.valid = $(form).valid();\n }\n\n // Check for invalid previous steps.\n $.each(userform.steps, (i, step) => {\n if (!step.valid && !step.conditionallyHidden()) {\n isValid = false;\n userform.errorContainer.addStepLink(step);\n }\n });\n\n if (isValid) {\n // When using the \"are you sure?\" plugin, ensure the form immediately submits.\n $(form).removeClass('dirty');\n\n form.submit();\n } else {\n userform.errorContainer.show();\n }\n },\n // When a field becomes valid.\n success: (error) => {\n const errorId = $(error).attr('id');\n const fieldId = errorId.substr(0, errorId.indexOf('-error')).replace(/[\\\\[\\\\]]/, '');\n\n // Remove square brackets since jQuery.validate.js uses idOrName,\n // which breaks further on when using a selector that end with\n // square brackets.\n\n error.remove();\n\n // Pass the field's ID with the event.\n userform.$el.trigger('userform.form.valid', [fieldId]);\n },\n };\n\n /**\n * @func UserForm.addStep\n * @param {object} step - An instance of FormStep.\n * @desc Adds a step to the UserForm.\n */\n UserForm.prototype.addStep = function addStep(step) {\n // Make sure we're dealing with a form step.\n if (!step instanceof FormStep) {\n return;\n }\n\n // eslint-disable-next-line no-param-reassign\n step.id = this.steps.length;\n\n this.steps.push(step);\n };\n\n /**\n * @func UserForm.setCurrentStep\n * @param {object} step - An instance of FormStep.\n * @desc Sets the step the user is currently on.\n */\n UserForm.prototype.setCurrentStep = function setCurrentStep(step) {\n // Make sure we're dealing with a form step.\n if (!(step instanceof FormStep)) {\n return;\n }\n\n this.currentStep = step;\n this.currentStep.show();\n\n // Record the user has viewed the step.\n this.currentStep.viewed = true;\n this.currentStep.$el.addClass('viewed');\n };\n\n /**\n * @func UserForm.jumpToStep\n * @param {number} stepNumber\n * @param {boolean} [direction] - Defaults to forward (true).\n * @desc Jumps to a specific form step.\n */\n UserForm.prototype.jumpToStep = function jumpToStep(stepNumber, direction) {\n const targetStep = this.steps[stepNumber];\n let isValid = false;\n const forward = direction === void 0 ? true : direction;\n\n // Make sure the target step exists.\n if (targetStep === void 0) {\n return;\n }\n\n // Make sure the step we're trying to set as current is not\n // hidden by custom display rules. If it is then jump to the next step.\n if (targetStep.conditionallyHidden()) {\n if (forward) {\n this.jumpToStep(stepNumber + 1);\n } else {\n this.jumpToStep(stepNumber - 1);\n }\n\n return;\n }\n\n // Validate the form.\n // This well effectivly validate the current step and not the entire form.\n // This is because hidden fields are excluded from validation, and all fields\n // on all other steps, are currently hidden.\n isValid = this.$el.valid();\n\n // Set the 'valid' property on the current step.\n this.currentStep.valid = isValid;\n\n // Users can navigate to step's they've already viewed even if the current step is invalid.\n if (isValid === false && targetStep.viewed === false) {\n return;\n }\n\n this.currentStep.hide();\n this.setCurrentStep(targetStep);\n\n this.$el.trigger('userform.form.changestep', [targetStep.id]);\n };\n\n /**\n * @func UserForm.nextStep\n * @desc Advances the form to the next step.\n */\n UserForm.prototype.nextStep = function nextStep() {\n this.jumpToStep(this.steps.indexOf(this.currentStep) + 1, true);\n };\n\n /**\n * @func UserForm.prevStep\n * @desc Goes back one step (not bound to browser history).\n */\n UserForm.prototype.prevStep = function prevStep() {\n this.jumpToStep(this.steps.indexOf(this.currentStep) - 1, false);\n };\n\n /**\n * @func main\n * @desc Bootstraps the front-end.\n */\n function main(index, userformElement) {\n const $userform = $(userformElement);\n\n // If there's no userform, do nothing.\n if ($userform.length === 0) {\n return;\n }\n\n CONSTANTS.ENABLE_LIVE_VALIDATION = $userform.data('livevalidation') !== void 0;\n CONSTANTS.DISPLAY_ERROR_MESSAGES_AT_TOP = $userform.data('toperrors') !== void 0;\n\n // Extend the default validation options with conditional options\n // that are set by the user in the CMS.\n if (CONSTANTS.ENABLE_LIVE_VALIDATION === false) {\n $.extend(UserForm.prototype.validationOptions, {\n onfocusout: false,\n });\n }\n\n if (CONSTANTS.DISPLAY_ERROR_MESSAGES_AT_TOP) {\n $.extend(UserForm.prototype.validationOptions, {\n // Callback for custom code when an invalid form / step is submitted.\n invalidHandler: (event, validator) => {\n $userform.trigger('userform.form.error', [validator]);\n },\n onfocusout: false,\n });\n }\n\n // Display all the things that are hidden when JavaScript is disabled.\n $('.userform-progress, .step-navigation').attr('aria-hidden', false).show();\n\n // Extend classes with common functionality.\n $.extend(FormStep.prototype, commonMixin);\n $.extend(ErrorContainer.prototype, commonMixin);\n\n userform = new UserForm($userform);\n\n // Conditionally hide field labels and use HTML5 placeholder instead.\n if (CONSTANTS.HIDE_FIELD_LABELS) {\n $userform.find('label.left').each(() => {\n const $label = $(this);\n\n $(`[name=\"${$label.attr('for')}\"]`).attr('placeholder', $label.text());\n $label.remove();\n });\n }\n\n // Initialise the form steps.\n userform.$el.find('.form-step').each((i, element) => {\n const step = new FormStep(element);\n\n userform.addStep(step);\n });\n\n userform.setCurrentStep(userform.steps[0]);\n\n // Initialise actions and progressbar\n const progressBar = new ProgressBar($('#userform-progress'));\n progressBar.update(0);\n\n const formActions = new FormActions($('#step-navigation'));\n formActions.update();\n\n // Enable jQuery UI datepickers\n $(document).on('click', 'input.text[data-showcalendar]', () => {\n const $element = $(this);\n\n $element.ssDatepicker();\n\n if ($element.data('datepicker')) {\n $element.datepicker('show');\n }\n });\n\n // Make sure the form doesn't expire on the user. Pings every 3 mins.\n setInterval(() => {\n $.ajax({ url: 'UserDefinedFormController/ping' });\n }, 180 * 1000);\n\n // Bind a confirmation message when navigating away from a partially completed form.\n const form = $('form.userform');\n if (typeof form.areYouSure !== 'undefined') {\n form.areYouSure({\n message: i18n._t('UserForms.LEAVE_CONFIRMATION', 'You have unsaved changes!'),\n });\n }\n }\n\n $('.userform').each(main);\n});\n\n\n\n// WEBPACK FOOTER //\n// ./client/src/bundles/UserForms.js","module.exports = i18n;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"i18n\"\n// module id = 2\n// module chunks = 0","module.exports = jQuery;\n\n\n//////////////////\n// WEBPACK FOOTER\n// external \"jQuery\"\n// module id = 3\n// module chunks = 0"],"sourceRoot":""} |