How do I have an alert - After Submit

needshelp 25 Jul, 2008
Okay, so I would like to have a Alert Box that thanks the visitor for filling out the form after the form has been e-mailed.

I had the alert message set onSubmit field but what would happen is the person click submit and didn't fill the rest of the form, it would tell them thank you for sending in the form, but It was not sent because they did not input the appropriate / valid fields.

What can I do?
Max_admin 25 Jul, 2008
Hi, use validation to check that your fields are ready!

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
needshelp 25 Jul, 2008
I have validations set up and it does do the java that shows "This Field is Required" but the problem is when you would hit submit,
if i a field was required it would run the alret box on submit and say "Thank you...", even though the form was not submitted.

I know people not familiar with forms out there might think that it was submitted.
needshelp 25 Jul, 2008
Is there a java script that I may run that checks with the validation, so if all fields are input correctly on submit it will say the "Thank You Message" in an alertbox, but if not then on submit it will say "Please Check All Fields, before submitting" or something along those lines?

Similar to the following, but I don't know what values to add to agree with the validation;


function checkscript() {
	if (some value is/is not something) {
		// something is wrong
		alert('alert user of problem');
		return false;
	}
	else if (another value is/is not something) {
		// something else is wrong
		alert('alert user of problem');
		return false;
	}

	// If the script makes it to here, everything is OK,
	// so you can submit the form

	return true;
}


Max_admin 25 Jul, 2008

I have validations set up and it does do the java that shows "This Field is Required" but the problem is when you would hit submit,
if i a field was required it would run the alret box on submit and say "Thank you...", even though the form was not submitted.

I know people not familiar with forms out there might think that it was submitted.



Just a question, why should the thank you be in a popup ?

if its a must then you can add this code to the onsubmit after email box :

echo "<script> alert('thanks!!!'); </script>\n";
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
needshelp 25 Jul, 2008
That works great, now the problem is 😲 if I have a URL redirect it does not run that script and just takes you to the new page.

So, I'm thinking of adding a redirect script after the alert in the "After Submit" field. Would that be correct?
Max_admin 25 Jul, 2008
Assuming you have Joomla 1.5 then you can write this line also :

global $mainframe;
$mainframe->redirect('this is the url where user will go');
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
needshelp 25 Jul, 2008
lol, no not using 1.5 yet. Using 1.0.15 😶 . By the way thank you for the quick help, I really appreciate it.
Max_admin 25 Jul, 2008
No worries, then use this instead:

mosRedirect('link is here');
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.