Adding Custom CSS To Show Form Submit Process
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.
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.
When you submit a Form, the HTML Form element has two class names added to it:
- "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.
In this example, we'll use CSS to select all Forms that are busy submitting globally. You may choose to select particular Forms differently.
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: