FORMS
Adding Custom CSS To Show Form Submit Process
6min
when a form submits, it can take a moment to make the requests it needs here's how you can use css to show submission progress introduction when a form submits, it can take a moment to make the requests it needs this is especially true with ecommerce forms which need to make multiple requests for security reasons this article will explain how you can use css to show submission progress and let the user know your form is still submitting without errors you may also be interested to read about how you can use a custom validation function to change the way the form behaves when validation errors are found custom javascript validation for forms the css class when you submit a form, the html form element has two class names added to it "form submitting" "form x submitting" where x represents the id of the form in admin these classes should be removed if the form is interrupted by a valid error, e g validation errors, so targeting one of these classes should tell you that the form is busy submitting and the user should wait for completion the simplest example in this example, we'll use css to select all forms that are busy submitting globally you may choose to select particular forms differently a more complex example in this example, a spinner icon has been added to the form layout in advance \<i class="fas fa spinner fa 5x">\</i> the css demonstrates how front end css is used to achieve a different effect validation a future update will remove the class "form submitting" when a validation error occurs for now, we'd recommend you follow the steps in this article to build a custom error function custom javascript validation for forms with this, you'll be able to write javascript to remove the "form submitting" class manually when there is an error var forms submitting = document queryselectorall("form submitting"); for (i=0;i\<forms submitting;i++) { forms submitting\[i] classlist remove("form submitting"); }