I tried to use the server side validation with no success with the following code:
One of the fields Email or Telefon should be filled, if you want to sent out the form.
If nothing filled has the variable $count=1, then I don't get an validation error and the form send it out. In this case, the form should not sending out. What can be the reason for this. Do I have a thinking error?
Thank you in advanced
Robert
<?php
$email = ($form->data['email']);
$telefon = ($form->data['telefon']);
if (($email =="") && ($telefon =="")) {
$form->validation_errors['telefon'] = "Bitte geben Sie entweder EMail oder Telefon an!";
}
$count = count($form->validation_errors);
if ($count > 0 ) {
return false;
}
?>
One of the fields Email or Telefon should be filled, if you want to sent out the form.
If nothing filled has the variable $count=1, then I don't get an validation error and the form send it out. In this case, the form should not sending out. What can be the reason for this. Do I have a thinking error?
Thank you in advanced
Robert
Hello parkplace,
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
Handling serverside validation errors . . .
How can I add Auto Serverside Validation?
How do I use Custom Serverside validation?
How can I run Auto and Custom Serverside Validation together?
How is client-side JavaScript validation enabled?
How can set client-side validation options?
What decides if clientside validation is enabled?
How can I add Auto Client side validation?
How can I add a Custom Client side validation?
P.S: I'm just an automated service😉
I'm not a Chrono professional, but after checking your new post, I think that the following links may help:
Handling serverside validation errors . . .
How can I add Auto Serverside Validation?
How do I use Custom Serverside validation?
How can I run Auto and Custom Serverside Validation together?
How is client-side JavaScript validation enabled?
How can set client-side validation options?
What decides if clientside validation is enabled?
How can I add Auto Client side validation?
How can I add a Custom Client side validation?
P.S: I'm just an automated service😉
I did read the documentation before, but I didn't find a solution.
Thanks.
Thanks.
Hi Robert,
The code you have here is for CFv4 and won't work in CFV5 :-(
There is no Custom Serverside Validation action in CFv5 but you can use an Event Switcher action from the Validation actions group in the same way. Here's some code I just tested that appears to do what you need:
Bob
The code you have here is for CFv4 and won't work in CFV5 :-(
There is no Custom Serverside Validation action in CFv5 but you can use an Event Switcher action from the Validation actions group in the same way. Here's some code I just tested that appears to do what you need:
<?php
if ( !$form->data['email'] && !$form->data['telefon'] ) {
$form->errors[] = 'Bitte geben Sie entweder EMail oder Telefon an!';
return 'fail';
}
?>
Bob
This topic is locked and no more replies can be posted.
