Hello to all,
with this latest version of CF i don't have understand how can i insert a custom server side validation!
If i put in on submit event "custom server side valdation" and in it i insert
Nothing happens!
I attach the scheme of my actions and events...
How can i fix it?
with this latest version of CF i don't have understand how can i insert a custom server side validation!
If i put in on submit event "custom server side valdation" and in it i insert
<?php
$error_count = 0;
if ( $form->data['ruolo'] == '' ) {
$form->validation_errors['ruolo'] = "Devi inserire il tuo titolo";
$error_count++;
}
if ( $error_count ) {
return false;
}
?>
Nothing happens!
I attach the scheme of my actions and events...
How can i fix it?
Hi mattiadj,
Please drag an Event Loop action into the pink On Fail event box of the Serverside validation action.
Bob
Please drag an Event Loop action into the pink On Fail event box of the Serverside validation action.
Bob
Ok,
then?and...why this??🙂 This CF is quite difficult than v3...😟
Edit:made it but now apache crashes!!
Setting attached as img
then?and...why this??🙂 This CF is quite difficult than v3...😟
Edit:made it but now apache crashes!!
Setting attached as img
Hi mattiadj ,
Yes . . . and it's midnight here. I'll be back in the morning.
Bob
Yes . . . and it's midnight here. I'll be back in the morning.
Bob
Hi mattiadj,
Back again,
The Event Loops should be set to the defafult > On Load so that they loop to the OnLoad event. (I suspect that you have them set to > On Submit which causes a loop and cracshes the site.
Also you should probably drag the Validation action before the Upload Files action.
Bob
Back again,
The Event Loops should be set to the defafult > On Load so that they loop to the OnLoad event. (I suspect that you have them set to > On Submit which causes a loop and cracshes the site.
Also you should probably drag the Validation action before the Upload Files action.
Bob
Ok now works but i don't understand why... when i have to use eventloop?and when i have to set to onsubmit or onload?
Also, in all part of form i have used this code to load the page
but now for the Server side validation it doesn't work. Since is a heavy validation is much easy for me to make an external file to manage...how can i do?
Also, in all part of form i have used this code to load the page
<?php
$path = JPATH_SITE;
require $path.'/form/preventivo/nameOfFile.ext';?>
but now for the Server side validation it doesn't work. Since is a heavy validation is much easy for me to make an external file to manage...how can i do?
Hi mattiadj,
The Event Loop action loads an Event. You set it to the Event you want to load. Most of the time it's used - as it is here - to reload the form by calling the On Load event.
Your require code should work OK for ServerSide validation :-(
I ran a test and it looks as though the return false; doesn't work from the included file. I got it working like this. In the Serverside validation action:
In the included file:
Bob
The Event Loop action loads an Event. You set it to the Event you want to load. Most of the time it's used - as it is here - to reload the form by calling the On Load event.
Your require code should work OK for ServerSide validation :-(
I ran a test and it looks as though the return false; doesn't work from the included file. I got it working like this. In the Serverside validation action:
<?php
include (JPATH_SITE.DS.'components'.DS.'com_chronoforms'.DS.'includes'.DS.'test_form_multi_validation'.DS.'serverside_validation.php');
if ( !$return ) {
return false;
}
?>
In the included file:
<?php
/* ensuring that this file is called up from another file */
defined('_JEXEC') or die('Restricted access');
$input_text_0 = JRequest::getVar('input_text_0', 'empty', 'post');
if ( $input_text_0 ) {
$form->validation_errors['input_text_0'] = "Text input was : ".$input_text_0;
$return = false;
}
?>
NB This validation is intended to fail, for testing purposes only!!Bob
This topic is locked and no more replies can be posted.