Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

Processing Form: Loading Indicator

Premium
3 min read

If the form takes longer to submit, then we need to show some kind of loading indicator and disable the submit button so the user wouldn't hit it twice.

loading indicator


It's pretty easy to achieve. In the posts Composable, we need a variable isLoading which will be true or false. When the button is clicked we just set it as true.

Also, we will reset the validation errors from the previous lesson. And if there are any errors, we need to set isLoading to false so that we could...

The Full Lesson is Only for Premium Members

Want to access all of our courses? (29 h 14 min)

You also get:

54 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

R
Rangoh ✓ Link copied!

Really useful. Now I am wondering in the composable way the best approach for dealing with same logic repeated all over the place. That is, clearly the 'isLoading' and 'validaitonErrors' will be needed on each CRUD. So, should a generic frontend Javascript interface should be coded or considering consumption of third party package?

E
Eric ✓ Link copied!

I have a tip for this. Use FormKit it can show errormrssages from the backend and also validate before submitting.

J
jwinder ✓ Link copied!

Can anyone answer why there isnt the await keyword after async in storePost? Was it overlooked or is it good practice to add it?