Checking field value with submited database

How to prevent duplicate form submissions in ChronoForms.

Overview

The issue occurs when using an Event Switcher action to check for existing database values, but an undefined index error appears due to an incorrect field name reference.
Replace the placeholder field name in the Event Switcher code with the exact name of your form input. Use a Debugger action to verify the correct field name in the submitted data array.

Answered
bo bonbin 05 Jan, 2016
Dear Support,

i would like to ask how to use event switcher to check if the value on some field has been submited before and prevent any duplicate value on that field in database, perhaps something like username / email checking on registration to avoid any double submited data.

i found this forum post, http://www.chronoengine.com/forums/posts/f5/t96748.html
i tried to put everything exactly like on the poster did , but when i tried to submit an submited value i got this error

Notice: Undefined index: input_name in /home/robtan19/nadbet89.com/test/administrator/components/com_chronoforms5/chronoforms/actions/event_switcher/event_switcher.php(26) : eval()'d code on line 11
thanks for registering

the code was :
<?php

$db = JFactory::getDBO();

$query = "

SELECT `id`

FROM `flczt_chronoengine_chronoforms_datatable_Register`

WHERE `norek` = '{$form->data['input_name']}' ;

";

$db->setQuery($query);

$options = $db->loadAssocList();

if ($options) {

echo 'fail';

}else{

return 'success';

}

?>


please guide me , or i'll really appreciate if there is any tutorial for this or for ajax validating will be better since user doesnt need to press submit to know if the value has been used before

thanks
robin
Gr GreyHead 05 Jan, 2016
Answer
Hi Robin,

Please try replacing input_name with the name of the form input which has the data you want to check. If you add a Debugger action temporarily that will show you what data is being submitted and is in the $form->data array.

Bob
bo bonbin 05 Jan, 2016
thanks bob you are the live saver, im gonna buy this compt since only this compt have this such a great feature even for someone who are blind with php.
This topic is locked and no more replies can be posted.