Forums

Check if form validates

spyrosel 13 Aug, 2014
Hello,

I want to check in if the form validates properly in order to display a "please wait" message.

This is the code I use (and works properly)

	jQuery('#submit_button').click(function() {
		jQuery('#submit_button').hide();
		jQuery('#pleasewait').fadeIn('slow');
	});


I just want an 'if' condition before fading in the message div (#pleasewait) that check if the form validates.

How can I do this?
spyrosel 16 Aug, 2014
Answer
I have found a workaround here: http://www.chronoengine.com/forums/posts/f2/t96876/loading-message-after-submit.html in case someone else is looking for something like this.

So my final code is:

	  
var validated = false;
	  var form = jQuery('#chronoform-get-a-free-quote');
	  jQuery(document).on('submit', form, function(event){
		if ( validated ) {
		  return;
		}
		  event.stopPropagation();
		  event.preventDefault();
		  showMessage();
	  });

	  function showMessage(){
		jQuery('#submit_button').hide();
		jQuery('#pleasewait').fadeIn('slow');
		validated = true;
		form.submit();
	  };
Max_admin 16 Aug, 2014
1 Likes
Thanks for posting your solution, starting from the next update, the following FAQ should be helpful:
http://www.chronoengine.com/faqs/70-cfv5/5230-validation-customization-in-cfv5.html

Regards,
Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.