Forums

Required fields are not validated

HerKle 06 Feb, 2012
I installed CFv4 on <!-- w --><a class="postlink" href="http://www.icebreaker2012.eu">www.icebreaker2012.eu</a><!-- w --> ("Registration"). Although I made most fields to be required I still can send an empty form. The forum is full of advice concerning some jquery and mootools questions which I do not understand. I tried jquery.noConflict as recommended without success. Since I am no programmer (and never dealed with JS) I am grateful if someone could give step-to-step help.
GreyHead 06 Feb, 2012
Hi HerKle,

You are using a very attractive and poorly written template :-(

It is loading two different versions of JQuery and putting neither of them into noConflict mode.

If you want to use ChronoForms and have the validation work on your forms then those problems have to be fixed :-( They are problems with the template and not with ChronoForms.

I have done something similar with another AS Template and, when I have the time, I intend to write up how to do it.

Bob
HerKle 06 Feb, 2012
I will send this further to the template makers....

To be able to continue work meanwhile, is there a possibility to check via php script? I did that in earlier times.
Where to put it?

Thanks for your help.
GreyHead 06 Feb, 2012
Hi HerKle,

There are Auto Serverside validation and Custom Serverside validation action available in the Advanced Wizard.

Bob
HerKle 06 Feb, 2012
The auto serverside check worked.
I tested (according to your book) the customized:
<?php
$messages=array();
$input_firstname=JRequest::getString('input_firstname','','post');
if(!$input_firstname) {
  $messages[]="Please enter your first name.";
}
if(count($messages)) {
  return implode('<br />',$messages);
}
?>

This didn't work. I presume due to changes from v3 to v4?
GreyHead 06 Feb, 2012
Hi HerKle,

It's on the Help tab (though with a typo). This code is now
<?php
$valid = true;
$input_firstname=JRequest::getString('input_firstname', '', 'post');
if ( !$input_firstname ) {
  $form->validation_errors['input_firstname'] = "Please enter your first name.";
  $valid = false;
}
return $valid;
?>
HerKle 06 Feb, 2012
That helped.

Thank you very much Greyhead!
This topic is locked and no more replies can be posted.