PDA

View Full Version : Clear Server Validation


gcollins189987
05-06-2009, 11:11 AM
I have created an update account page where the form gets populated from the database.

They then make the changes and submit. If there are errors then Validation show if comes into play on that same page.

But if they leave the page and come back to it the validation errors still appear. Even though everything is correct because the form gets loaded from the db again.

My trigger is Current Page Submit.

How do I clear the errors if they leave the page?

I am using asp.

Also:

I load the form values from the database and when they submit the form if there is an error I set the QS to fail=yes. I then check if it is yes and then load the form with what they submitted.

Sample Code:

value="<%If Request.QueryString("fail") = "yes" Then Response.Write(ValidatedField("updateAccount","customer_postcode")) Else Response.Write(rs_Account.Fields.Item("BuyerZip").Value) End If %>"

Is this the best way to do this? or is there a more simple way?

gcollins189987
05-07-2009, 07:42 AM
Any thoughts?

Ray Borduin
05-11-2009, 06:27 AM
That seems like a good method. For populating the form elements.

I suppose you could wrap your validation errors with the same if statement:

<%
If Request.QueryString("fail") = "yes" Then
%>
your error code here
<%
end if
%>

to solve the problem with the error messages.

Andrew Read
03-15-2010, 01:23 PM
That seems like a good method. For populating the form elements.

I suppose you could wrap your validation errors with the same if statement:

<%
If Request.QueryString("fail") = "yes" Then
%>
your error code here
<%
end if
%>

to solve the problem with the error messages.

Actually, I found the proper solution to this in another thread.

You need to put this after the closing html tag on your page:
<?php
if(isset($_SESSION['WAVT_usersInsert_405_Errors'])) {
unset($_SESSION['WAVT_usersInsert_405_Errors']);
}
?>of course WAVT_usersInsert_405_Errors needs to be changed to the name of your validation session variable.

This is something that the validation toolkit should be adding on its own, but is not.