Hi
I want to check is somebody already subscribed, the form then should give a message, Sorry, you already subscribed and the form should be "stopped"
I added a new event in the Eventswitcher, called "ingeschreven"
In this event I added a Systemmessage and a Stopper
In the PHP field I put this code
But the form does not stop, and no systemmessage
Note: I check on "Datum" and "email"
Both fields are in the form en DB table
Where am I going wrong?
I want to check is somebody already subscribed, the form then should give a message, Sorry, you already subscribed and the form should be "stopped"
I added a new event in the Eventswitcher, called "ingeschreven"
In this event I added a Systemmessage and a Stopper
In the PHP field I put this code
$datum = JRequest::getString('Datum', '', 'post');
$user_info = JRequest::getString('email', '', 'post');
if ( $datum && $user_info ) {
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `nestv_chronoengine_chronoforms_data_basic`
WHERE `Datum` = '{$datum}'
AND `email` = '{$user_info}';
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count > 0 ) {
return "ingeschreven";
}
But the form does not stop, and no systemmessage
Note: I check on "Datum" and "email"
Both fields are in the form en DB table
Where am I going wrong?
Hi Kees,
And where do you have this code ? did you test that it returns the correct value in this case ? please try to "echo" that event name, does it display correctly when the user is subscribed ?
You can also use a "Data read" function, and call your functions in the "found" event, the conditions can be like this:
In this case you don't need the code above or the event switcher.
Best regards,
Max
And where do you have this code ? did you test that it returns the correct value in this case ? please try to "echo" that event name, does it display correctly when the user is subscribed ?
You can also use a "Data read" function, and call your functions in the "found" event, the conditions can be like this:
Model.Datum:{data:Datum}
Model.email:{data:email}
In this case you don't need the code above or the event switcher.
Best regards,
Max
The code is in a PHP section (from "LOGIC")
This code worked fine in V4
Read Data does not work as you proposed
This code worked fine in V4
Read Data does not work as you proposed
Hi Kees,
Why "Read data" does not work as proposed ?
Can you post a screenshot of your "Events" section at the moment ?
Best regards,
Max
Why "Read data" does not work as proposed ?
Can you post a screenshot of your "Events" section at the moment ?
Best regards,
Max
Error message when Data Read implemented
#1054 Unknown column 'Model.Datum' in 'where clause' SQL=SELECT COUNT(`Data46`.`aid`) AS `Data46.count` FROM `#__chronoengine_chronoforms_data_basic` AS `Data46` WHERE `Model`.`Datum` = '13-05-2017' AND `Model`.`email` = 'xxxxx@xxxxx.nl';
Hi Kees,
Yes, the "Model" in this case should be "Data46", its written at the top of the function config.
Best regards,
Max
Yes, the "Model" in this case should be "Data46", its written at the top of the function config.
Best regards,
Max
This topic is locked and no more replies can be posted.