-
- 388 Posts
Hello, using FormIt I have a form that is processing and sending quite a lot of data and sometimes it takes few seconds to do it.
Is there a way to trigger any DIV or any animation while is sending? so the client will know that is in process.
Thank you!
--
ysanmiguel.com
-
- 932 Posts
yeah just add a fixed position div overlay with your animation in and then assign an id to your submit button and use javascript/jquery to fade in the div. Assuming you're redirecting after submission you also don't need to worry about hiding it again on success
$('#submit-btn').click(function(event) {
$('#loading-div').fadeIn();
});
-
- 388 Posts
Good, but what happen in case the client click on submit and there is an error, the event $('#loading-div').fadeIn(); is going to trigger anyway.
I was thinking something like a hook before sending or something like that?
thanks LK
--
ysanmiguel.com
-
- 932 Posts
Setup your form validation in javascript also and if validated then launch the div
-
- 932 Posts
You may be able to do a prehook to echo out a div, but it would be a lot faster to do your front-end validation and other fe requests as front-end developments.