For real, I have a hard time getting chronoform to work with server side validation. After a whole week of trial and error I finally figure it out to create a contact form that use server side server side validation.
I would like to share 2 little hacks, not sure is that consider hack anot. 🤣
1. If you want the form and error to display on the same page instead of going to a new page after submitting, go to
Form URLs > Submit URL key in "index.php?option=com_chronocontact&task=send&chronoformname=contactForm&Itemid=12".
The front part of the url can copy from chronoform front page under Link. Itemid=12 is the menu id where you want the submit page to go back to.
2. Stop the form to send out email if validation contain error. Solution can be found in some of the thread but I would like to share the simple method for server side validation.
In chronocontact.php after line 419 comment out the existing method, type in
after the change in chronocontact.php file, at On Submit code - before sending email: type in
Hope is not too confusing, not very good at explaining stuff. :mrgreen:
I would like to share 2 little hacks, not sure is that consider hack anot. 🤣
1. If you want the form and error to display on the same page instead of going to a new page after submitting, go to
Form URLs > Submit URL key in "index.php?option=com_chronocontact&task=send&chronoformname=contactForm&Itemid=12".
The front part of the url can copy from chronoform front page under Link. Itemid=12 is the menu id where you want the submit page to go back to.
2. Stop the form to send out email if validation contain error. Solution can be found in some of the thread but I would like to share the simple method for server side validation.
In chronocontact.php after line 419 comment out the existing method, type in
if ( !empty($rows[0]->onsubmitcodeb4) )
{
if ($returnval = eval( "?>".$rows[0]->onsubmitcodeb4 ))
{
showform($_POST); // shown the form again if contain error
return;
}
}
after the change in chronocontact.php file, at On Submit code - before sending email: type in
$errormessag = 'anything'; // fake info
return $errormessag; // return will prevent the email from sending out if there is any validating error
Hope is not too confusing, not very good at explaining stuff. :mrgreen: