close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Form Tool Newbie

Thread began 12/07/2010 10:41 am by jbprincipato1419364 | Last modified 12/08/2010 9:19 am by Jason Byrnes | 2292 views | 7 replies |

jbprincipato1419364

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>

Sign in to reply to this post

Jason ByrnesWebAssist

server validations must be applied to the forms action page.


if the form is set to post to test2.php, you need to apply server validations to test2.php.

Sign in to reply to this post

jbprincipato1419364

So if I change the Action="test2.php" to Action="test1.php" the server validations should work? Also is there an example form with validations created with form toolkit that I can look at to see how the server validation and show if is configured?

Sign in to reply to this post

Jason ByrnesWebAssist

yes, if you set the action of the form to post to itself, then the validation should work.

No, there is not an example form available.

Sign in to reply to this post

jbprincipato1419364

Thanks it works. So how do you navigate to a new page when all validations are passed?

Sign in to reply to this post

jbprincipato1419364

also I added a second field to test. If one field is valid and a second is invalid, the valid field is blanked which caused me to reenter the same data. into a previously valid field.

Sign in to reply to this post

jbprincipato1419364

Looks like there is a bug per thread
showthread.php?t=17413

To maintain form values after validation.

Sign in to reply to this post

Jason ByrnesWebAssist

di you download the fix from this post:
showpost.php?p=82595&postcount=10

does it fix the issue for you?

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...