Hi, I have a question regarding the capabilities of ChronoForms.
I'm wondering if it's possible to use a particular field to restrict form submissions.
Bearing in mind that this will be for any user, not just registered users.
So (for example), let's say I have a "name" textbox. I only want each "name" to be able to submit the form once. (I'm aware of the potential problems of only checking on a "name" field...just want to get this working before I go further)
Is there a way of checking the database for a matching "name" entry, and halting any further progress if so. (e.g. Not entering the details into a DB table, not sending any emails out).
I have seen similar answers on this board, but only to do with registered users. I have tried to modify that code (currently in the On Submit code - before sending email: field).
So what happens currently is that the form works fine when entering new names.
When entering a name that already exists, the "sorry no duplicate entries" message comes up correctly.
However, the details are stilled added to the connected DB table, and the relevant emails are still sent out.
If anyone can help, it'd be much appreciated.
Thanks
I'm wondering if it's possible to use a particular field to restrict form submissions.
Bearing in mind that this will be for any user, not just registered users.
So (for example), let's say I have a "name" textbox. I only want each "name" to be able to submit the form once. (I'm aware of the potential problems of only checking on a "name" field...just want to get this working before I go further)
Is there a way of checking the database for a matching "name" entry, and halting any further progress if so. (e.g. Not entering the details into a DB table, not sending any emails out).
I have seen similar answers on this board, but only to do with registered users. I have tried to modify that code (currently in the On Submit code - before sending email: field).
<?php
$db =& JFactory::getDBO();
$query = "
SELECT COUNT(*)
FROM `#__chronoforms_Testing`
WHERE `name` like '".$_POST['name']."';
";
$db->setQuery($query);
$count = $db->loadResult();
if ( $count ) {
echo "Sorry, no duplicate entries.";
return;
}
else{
?>
<p>
Thanks for your entry!</p>
<?php
}
?>
So what happens currently is that the form works fine when entering new names.
When entering a name that already exists, the "sorry no duplicate entries" message comes up correctly.
However, the details are stilled added to the connected DB table, and the relevant emails are still sent out.
If anyone can help, it'd be much appreciated.
Thanks