close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Conflict Validation Toolkit and Form Toolkit plus more.

Thread began 2/18/2011 12:02 am by enquiry272230 | Last modified 4/11/2011 3:13 pm by Banksie | 1756 views | 6 replies |


Conflict Validation Toolkit and Form Toolkit plus more.

I have an email form at enquiries.php under construction.

I set up file upload and validation on file size with Validation toolkit.
All worked well.

I then decided I needed Captcha, so I bought Form Toolkit yesterday.

After applying Captcha and applying Show if (separate problem), I couldn't get the page to display due to a PHP conflict between the Validation Toolkit 2 files and the form toolkit files.
<?php require_once("webassist/form_validations/wavt_scripts_php.php"); ?>
<?php require_once("webassist/form_validations/wavt_validatedform_php.php"); ?>
<?php require_once("WA_ValidationToolkit/WAVT_Scripts_PHP.php"); ?>
<?php require_once("WA_ValidationToolkit/WAVT_ValidatedForm_PHP.php"); ?>

So I deleted the older "WA_ValidationToolkit" scripts and then the page would display.

But the show if behaviour didnt work.

On examination of the code, there was a conflict between the original file size server behaviour, and the show if server behaviour, in that the show if server behaviour setup thought that the code block from the file size server behaviour was the one to use for the show if code, despite my following setup correctly.

e.g, This is the PHP code that now enables "Show If" to work:

$WAFV_Redirect = "enquiries.php";
$_SESSION['WAVT_enquiries_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateNM(((isset($_FILES["file"]))?$_FILES["file"]["size"]:"") . "",0,5000000,"",",.",true,1);
$WAFV_Errors .= WAValidateLE($_SESSION['captcha_Security_Code_1'] . "",((isset($_POST["Security_Code_1"]))?$_POST["Security_Code_1"]:"") . "",true,2);

if ($WAFV_Errors != "") {

The "Show if" application originally installed a second code block similar to this, containing the line: $WAFV_Errors .= WAValidateLE($_SESSION['captcha_Security_Code_1'] . "",((isset($_POST["Security_Code_1"]))?$_POST["Security_Code_1"]:"") . "",true,2);

So I had to lift this line of code, and place it in the first code block, because the "Show If" behaviour (following) expected it to be there, and delete the second code block.

<img id="capt1" src="webassist/captcha/wavt_captchasecurityimages.php?width=200&height=50&field=Security_Code_1&bgcolor=FFFFFF&transparent=1&bgimage=&gridfreq=20&gridcolor=000000&gridorder=behind&noisefreq=20&noisecolor=000000&noiseorder=behind&characters=5&charheight=&font=fonts/MYTYPE.TTF&textcolor=000000" alt="security code" width="200" height="50" /><br />
<input id="Security_Code_1" name="Security_Code_1" type="text" value="" /><br />
if (ValidatedField('enquiries','enquiries')) {
if ((strpos((",".ValidatedField("enquiries","enquiries").","), "," . "2" . ",") !== false || "2" == "")) {
if (!(false)) {
<span style="color:#F00;">Wrong Code - Try Again</span>
<?php //WAFV_Conditional enquiries.php enquiries(2:)

Now all is working fine, basically, except I have another 2 problems now.
If a user incorrectly places the captcha text in the box, the error message appears correctly, but all of the other form input dissapears and the user has to re-input.

If the above occurs, the captcha text is entered correctly, and the user later gets a "File too large" error message, the Captcha error message is also displayed.
I believe it it because the errors are stored in Sessions?

If a user incorrectly places the captcha text in the box, the error message appears correctly, and all of the other form input dissapears.
If the user leaves the page and later returns, the captcha error message is still there.

I have spent three days of unproductive time on this, due I believe to imperfect communication between the various extensions.

In order for this form to be a professional job, I need the error messages to perform better. Please assist.
At the moment, I feel like dumping webassist completely.

Sign in to reply to this post

Jason ByrnesWebAssist

form toolkit should not be added to page that already has validation toolkit applied to it, the existing validation and validation show if behaviors from validation toolkit should be removed from the page, then recreated using form toolkit.

to have the valid form elements retain the values on validation failure, bind the initial value of each form element to the corresponding binding in the Validated entries collection.

Select each form element in design view, then click the Lightning bolt next to initial value in the property inspector, in the Bindings panel, expand the validated entries collection and select the corresponding binding.

The errors are store in a session variable, if the validation fails the errors will be displayed on the page if the users browses away and comes back until the form is successful submitted.

to prevent this from happening, you can add the following code after the closing </html> tag:

<?php unset($_SESSION['WAVT_enquiries_Errors']); ?>

please send a copy of the page so i can look into why the captcha error shows when file size validation fails.

Sign in to reply to this post


Enquiries page attached as zip

Hi Jason,

Thanks for looking into this.
Enquiries page attached as zip
I had the page partly built before purchasing Form Toolkit.

I have not completed the validation on the form content yet, only on the file size and Captcha, I will be sure to use form toolkit validation.

I have been testing the form for every scenario, file, no file, file too big, incorrect captcha code, etc.

I think that, if the Captcha code text input is incorrect on first try, then on next try, with a correct Captcha Code text, the file size is too big, then the captcha error displays because the Captcha error session value is not cleared. (if that makes sense)

I will try your suggested fix.

Attached Files
Sign in to reply to this post



For the moment its fixed.

I set the Captcha validation to "Submit Button Pressed" and the file size validation to "Any Form Post".

The second "Show If" behaviour still read incorrectly on setup from the first server behaviour code block, had to change it by hand.

Sign in to reply to this post


Continuing Validations setup

Hi Jason,

Despite following your instruction on how to retain the form data already entered correctly by binding with the Validated Entries, as soon as an error message appears, either a Captcha error or input error, the form data disappears.

I have set some code at the page bottom to show the session data in memory, and the session data is there, but not displaying in the form input box.

Session Data after First Name and Last Name only entered:

WAVT_firstname=Stan&WAVT_lastname=White&WAVT_address=&WAVT_address2=&WAVT_city=&WAVT_state=&WAVT_postcode=&WAVT_country=&WAVT_telephone=&WAVT_email=&WAVT_message=&WAVT_Security_Code_1=&WAVT_submit=Send Message&WAVT_enquiries_086_Errors=2,6,7,8,9,10,11,12,13

Sign in to reply to this post


Error in WA Validations.

Found the reason input not being retained.

<input name="lastname" type="text" size="25" maxlength="60" value="<?php echo(ValidatedField("enquiries","address2")) ?>" />

Should be:

<input name="lastname" type="text" size="25" maxlength="60" value="<?php echo(ValidatedField("enquiries_086","address2")) ?>" />

enquiries_086 stores the session data, not just enquiries.
The validations have a random numeral added to the session data name

I guess it's another bug, see below:

if (isset($_POST["submit"])) {
$WAFV_Redirect = "enquiries.php";
$_SESSION['WAVT_enquiries_086_Errors'] = "";
if ($WAFV_Redirect == "") {
$WAFV_Redirect = $_SERVER["PHP_SELF"];
$WAFV_Errors = "";
$WAFV_Errors .= WAValidateLE(strtolower($_SESSION['captcha_Security_Code_1']) . "",strtolower(((isset($_POST["Security_Code_1"]))?$_POST["Security_Code_1"]:"")) . "",true,2);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["firstname"]))?$_POST["firstname"]:"") . "",false,3);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["lastname"]))?$_POST["lastname"]:"") . "",false,4);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["city"]))?$_POST["city"]:"") . "",false,6);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["state"]))?$_POST["state"]:"") . "",false,7);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["postcode"]))?$_POST["postcode"]:"") . "",false,8);
$WAFV_Errors .= WAValidateRQ(((isset($_POST["country"]))?$_POST["country"]:"") . "",false,9);
$WAFV_Errors .= WAValidateAN(((isset($_POST["telephone"]))?$_POST["telephone"]:"") . "",true,true,true,true,"",true,10);
$WAFV_Errors .= WAValidateAN(((isset($_POST["address"]))?$_POST["address"]:"") . "",true,true,true,true,"",true,11);
$WAFV_Errors .= WAValidateEM(((isset($_POST["email"]))?$_POST["email"]:"") . "",true,12);
$WAFV_Errors .= WAValidateAN(((isset($_POST["message"]))?$_POST["message"]:"") . "",true,true,true,true,"",true,13);

if ($WAFV_Errors != "") {

Sign in to reply to this post


Boy, am I glad I found this posting as have been tearing my hair out trying to find the solution to the same problem - hand hacking the session name to include the random _NNN solves the problem.

I hope this'll be a fix in the next dot release?????

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





Ease of use


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...