Hello,
There's a great feature "Server Side Validation" one can setup for each individual form.
Is there a way to setup a single common "Server Side Validation Code" that all forms could share?
Thank you.
There's a great feature "Server Side Validation" one can setup for each individual form.
Is there a way to setup a single common "Server Side Validation Code" that all forms could share?
Thank you.
Hi anv2009,
Yes I think so, you can certainly include an external file into most of the ChronoForms edit boxes. I frequently do this with the Form HTML because it makes editing easier. I create an 'includes' sub-folder in components/com_chronocontact and then put something like this
I don't think I've tested this with ServerSide validation so please let us know if it works.
Bob
PS The if ( !$mainframe->isSite() ) { return; } line is there to prevent ChronoForms from trying to evaluate the code in the site admin. It is needed for formhtml, possibly not for validation.
Yes I think so, you can certainly include an external file into most of the ChronoForms edit boxes. I frequently do this with the Form HTML because it makes editing easier. I create an 'includes' sub-folder in components/com_chronocontact and then put something like this
<?php
if ( !$mainframe->isSite() ) { return; }
require_once(JPATH_SITE.DS.'components'.DS.'com_chronocontact'.DS.'includes'.DS.'ss_validation.php');
?>
into the ChronoForms ServerSide validation box. Use the same code in each form and the same validation file will be included. You'll need to make sure that the input names are matched up as well.I don't think I've tested this with ServerSide validation so please let us know if it works.
Bob
PS The if ( !$mainframe->isSite() ) { return; } line is there to prevent ChronoForms from trying to evaluate the code in the site admin. It is needed for formhtml, possibly not for validation.
Bob,
This is a great tip. I usually put something like
In order to keep the Form Javascript require_once at the bare minimum, I also start myfile.php with
norguir
This is a great tip. I usually put something like
<?php
require_once(JPATH_SITE.DS.'components'.DS.'com_chronocontact'.DS.'includes'.DS.'myfile.php');
?>
in the Form Javascript field insteadof Form HTML field. This way, it is not overwritten by the form wizard each time I make a change. In order to keep the Form Javascript require_once at the bare minimum, I also start myfile.php with
<?php
if ( !$mainframe->isSite() ) { return; }
...
norguir
This topic is locked and no more replies can be posted.