This repository has been archived by the owner on Mar 27, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Renamed `this.consentNeeded` in action_form.js to `this.async` as it was confusing when read side by side with consent.isRequired. This should clear any ambiguity: `async` in this case means that the form is submitted asynchronously, hence validation happens first, then submission will happen eventually (async), not on click/submit. * Cleaned up PetitionAndScrollToConsent: - Removed all code that manually submits the form, and replaced with a Backbone.trigger('form:submit_action_form') global event. ActionForm listens for this event and then submits the form. - Removed manual checking for '/validate' in the action form's url. Instead, we initialise ActionForm with `async: true` and this will make it validate by default (and trigger a `form:validated` global event on success). - Listen to two distinct events: `form:validated` and `form:submitted`. On validation, we scroll to consent, and on submission, we redirect to followUpUrl. - Removed redundant setupStore method. The store is now initialised on page load and does not depend on any component to be initialised. ActionForm now dispatches a changeVariant on initialisation, and listens for changes on the country select, updating the store on changes.
- Loading branch information
Showing
2 changed files
with
30 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters