Greetings,
Came across this issue with the generated php when server side validation is enabled. The $error variable seems to be evaluated after the mailto and so it never catches any error.
try {
if (!ValidateEmail($mailfrom))
{
$error .= "The specified email address (" . $mailfrom . ") is invalid!\n<br>";
throw new Exception($error);
}
if (empty($_POST['TextArea1']))
{
$error .= "Too many char\n<br>"; // NO THROW EXCEPTION HERE
}
if (strlen($_POST['TextArea1']) < 5)
{
$error .= "Too many char\n<br>";
}
if (strlen($_POST['TextArea1']) > 40)
{
$error .= "Too many char\n<br>"; //IF MORE THAN 40 CHARACTERS ENTERED THE CODE DOES NOTHING IT SENDS THE MAIL
}
$message .= $eol;
$message .= "IP Address : ";
$message .= $_SERVER['REMOTE_ADDR'];
$message .= $eol;
$message .= "Referer : ";
$message .= $_SERVER['SERVER_NAME'];
$message .= $_SERVER['PHP_SELF'];
$message .= $eol;
$body .= '--'.$boundary.'--'.$eol;
if ($mailto != '') THIS ONLY CHECKS IF THE MAILTO ADDRESS IS PRESENT IT SHOULD ALSO CHECK FOR IF $ERROR IS NOT EQUAL TO BLANK
{
mail($mailto, $subject, $body, $header); // MAIL IS SENT OVER HERE
}
header('Location: '.$success_url);
}
catch (Exception $e)
{
$errorcode = file_get_contents($error_url);
$replace = "##error##";
$errorcode = str_replace($replace, $e->getMessage(), $errorcode);
echo $errorcode;
}
exit;
}
?>
Server Side Validation - $Error does not throw exception
Forum rules
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/forms.html
http://www.wysiwygwebbuilder.com/form_wizard.html
Frequently Asked Questions about Forms
PLEASE READ THE FORUM RULES BEFORE YOU POST:
viewtopic.php?f=12&t=1901
MUST READ:
http://www.wysiwygwebbuilder.com/forms.html
http://www.wysiwygwebbuilder.com/form_wizard.html
Frequently Asked Questions about Forms
Re: Server Side Validation - $Error does not throw exception
Thanks for the information!
This issue has addressed in the latest build (12/10/2019)
http://www.wysiwygwebbuilder.com/download.html
This issue has addressed in the latest build (12/10/2019)
http://www.wysiwygwebbuilder.com/download.html
Re: Server Side Validation - $Error does not throw exception
Thanks, so after I download this fix, do I just reopen each project and redeploy?
Re: Server Side Validation - $Error does not throw exception
Tested it, works fine now! Thanks