I've created a form using BreezingForms(free). Before submitting the form I'm checking if the entered email address is unique using the "Before submit" field in my form settings. The code I am using is :
$this->execPieceByName('ff_InitLib');
$email = '\'' . ff_getSubmit('email_test') . '\'';
$value = ff_selectValue('SELECT * FROM kvkfr_users WHERE email= ' . "$email");
if($value != ''){
echo "<script> alert('Email is not unique'); </script>";
exit();
}
My code runs as expected and if a duplicate email address is found I am getting the "Email is not unique" alert, but after that my page refreshes and I get a blank white page.I just want to stop the submitting process without refreshing the page(if possible). What should I use instead of exit()
to stop the submitting process and stay on the page?
PS. Should I use ff_selectValue()
or Joomlas database object to execute my query?