Hi all.
I have a snippet which prevents someone with the same email address submitting a form more than once.
It works, but it doesn’t output anything on the screen for the users to know. It just doesn’t submit.
It’s probably very simple, but I can’t work out how to print an error to say ‘Sorory you’ve already submitted this form!’.
This is my hook below:
<?php
$modx->addPackage('formit', $modx->getOption('core_path').'components/formit/model/');
$email = $hook->getValue('email'); //play with this email, put here emails that occur for the first time or those that are already in the database
$formName = $modx->getOption('formName', $scriptProperties, '');
if($modx->getCollection('FormItForm',array('values:LIKE' => "%$email%", 'form' => $formName))){
$modx->log(xPDO::LOG_LEVEL_ERROR, 'Email exists', '', 'electionPreventDupeVotes');
return false;
}
$modx->log(xPDO::LOG_LEVEL_ERROR, 'There are no such emails', '', 'electionPreventDupeVotes');
return true;
it’s working because the logs are updating, but how do i add a message to the user on screen?
Thanks!
Andy