Hi!
I'm trying to use Custom Server Side Validation to check a textbox input against a ChronoForm DB record to check if the number provided by user is already at DB, to limit user to send form only once. This number is always unique to a person in my country and we call it DNI, and it is something like the Social Security Number in USA.
I named DB 'mbod_concurso20120101', and DNI textbox field name is 'dni'. Model ID, which I don't know what it is but I think you might need it, is 'chronoform_data'. Joomla es 1.5.x and ChronoForm is V4 RC3.11.
I was trying some modified code I found in this forum, but it is not working, it always return false. I'm using Form Wizard in Extended Mode.
I attach a capture of Events tab: the idea behind all this is, after user submit form, check DB to see if DNI is already at DB records. If DNI is new then go to OnSuccess, send OK message and Save to DB new record. If DNI is already in DB then go to OnFail and send Error message.
I know I must be doing something silly, as my knowledges of PHP and SQL are tremendously limited.
Thanks in advance for your help!
I'm trying to use Custom Server Side Validation to check a textbox input against a ChronoForm DB record to check if the number provided by user is already at DB, to limit user to send form only once. This number is always unique to a person in my country and we call it DNI, and it is something like the Social Security Number in USA.
I named DB 'mbod_concurso20120101', and DNI textbox field name is 'dni'. Model ID, which I don't know what it is but I think you might need it, is 'chronoform_data'. Joomla es 1.5.x and ChronoForm is V4 RC3.11.
I was trying some modified code I found in this forum, but it is not working, it always return false. I'm using Form Wizard in Extended Mode.
I attach a capture of Events tab: the idea behind all this is, after user submit form, check DB to see if DNI is already at DB records. If DNI is new then go to OnSuccess, send OK message and Save to DB new record. If DNI is already in DB then go to OnFail and send Error message.
<?php
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `mbod_concurso20120101`
WHERE `dni` = '{$form->data['dni']}' ;
";
$db->setQuery($query);
$resultado = $db->loadResult();
if ( $resultado ) {
return true;
}
else {
return false;
}
?>
I know I must be doing something silly, as my knowledges of PHP and SQL are tremendously limited.
Thanks in advance for your help!