Form Tool Newbie
Sorry, newbie here. I just purchased the form toolkit. I am trying to configure server validation on a test form and I can't get it to show the error message and reload the form page. I created a form (test1.php) with one text field in it (tst_txt), set the action to test2.php, method is post.
I followed the instructions and select Web Assist forms/ Validation/ Server Validation. I filled out the validation form by selecting any form post/required/not blank/selection made, server variable tst_txt, clicked the + sign, selected test1.php as the failed redirect, pressed ok.
Then I selected the error message text on the page, selected webassist/validation/showif. Then I selected test1.php as the validation page/validation fail - any/tst_txt reqired code. Pressed ok.
When I run the form it always goes to test2.php whether I enter text into the field or not.
Below is the php that was generated by webassist form toolkit:
<?php require_once("webassist/form_validations/wavt_scripts_php.php"); ?>
<?php require_once("webassist/form_validations/wavt_validatedform_php.php"); ?>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$WAFV_Redirect = "test1.php";
$_SESSION['WAVT_test1_470_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
}
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateRQ(((isset($_POST["tst_txt"]))?$_POST["tst_txt"]:"") . "",true,1);
if ($WAFV_Errors != "") {
PostResult($WAFV_Redirect,$WAFV_Errors,"test1_470");
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<link type="text/css" href="webassist/datepicker/test1_datepicker_1/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="webassist/jquery/jquery.js"></script>
<script type="text/javascript" src="webassist/jquery/jquery-ui.js"></script>
<script type="text/javascript">
$(function(){
$('#datepicker_1').datepicker({
dateFormat: 'yy-mm-dd',
showAnim: 'show',
onClose: closeDatePicker_datepicker_1
});
});
function closeDatePicker_datepicker_1() {
var tElm = $('#datepicker_1');
if (typeof datepicker_1_Spry != null && typeof datepicker_1_Spry != "undefined") {
datepicker_1_Spry.validate();
}
var docElm = document.getElementById("datepicker_1");
var tBlur = docElm.getAttribute("onBlur");
if (!tBlur) tBlur = docElm.getAttribute("onblur");
if (!tBlur) tBlur = docElm.getAttribute("ONBLUR");
if (tBlur) {
tBlur = tBlur.replace(/\bthis\b/g, "docElm");
eval(tBlur);
}
}
</script>
</head>
<body>
<form action="test2.php" method="post">
<p>test:
<input type="text" name="tst_txt" id="tst_txt" />
<?php
if (ValidatedField('test1_470','test1_470')) {
if ((strpos((",".ValidatedField("test1_470","test1_470").","), "," . "1" . ",") !== false || "1" == "")) {
if (!(false)) {
?>
This is an error message
<?php //WAFV_Conditional test1.php test1_470(1:)
}
}
}?>
</p>
<p>
<input name="Submit" type="Submit" value="Submit" />
</p>
</form>
</body>
</html>