PDA

View Full Version : Validation just not working, at all! :o(


Nathon Jones
06-17-2009, 03:43 AM
I had Client Validation setup on a form and had been having problems whereby spammers were still able to, somehow, submit links via my contact forms. I changed the validation to Server and now it's not working at all. The form submits through to my thank you page, no validation, nothing! :o(

Worryingly, it's also stopped my Universal E-mail from working correctly! Everything was fine until I switched to Server Validation.

I've got the validation triggering "When Submit is pressed". Should the validation actually be on my thank you page?

Is it ok to post links in this forum?

Would appreciate any advice, anyway, thanks.
Nathon

EDIT: Should the form's action be submitting to itself? Also, I just tried setting this up on another form and it also isn't working.

Ray Borduin
06-17-2009, 07:35 AM
The validation code should be added to the form action page.

If the action points to the thank you page, then the validation should be added to that page as well.

Go ahead and post links to your sample pages. That helps since I could look at the action instead of just telling you to.

Nathon Jones
06-17-2009, 08:10 AM
Hi Ray,

Link is:
http://www.mildandbitter.co.uk/draft/wigan-athletic-book.asp

I need the form to submit to the thank you page because I have Universal E-mail redirecting the form data to an e-mail address.

One problem though is that the thank you page is PHP, but the form page is ASP (don't ask!). Not sure if that will affect the validation, will it?

Am I going about this the wrong way?

Thanks again.
Nathon

Ray Borduin
06-17-2009, 08:26 AM
This will effect the validation. Since it depends on Session variables for storing validation information and I don't think php and ASP sessions can communicate with eachother.

You can probably get the validation to work, but you won't be able to repopulate the form with the validated values on failure. You might be able to get around that by using WebAssist cookies toolkit and storing and retrieving the form from a cookie.

The validation code has to be applied on the form action page. So you would apply it on the thank you page.

Nathon Jones
06-17-2009, 08:41 AM
I thought that would be the case. That's a shame.

The host has said that CDONTS for ASP works on the Linux server but I'm getting the following MailFormat error from Universal Email on the thank you page:

Error Type:
Sun ONE ASP VBScript runtime (0x800A01B6)
Object does not support this property or method: 'MailFormat'
WA_Universal_Email/CDONTS_NewMail_VB.asp, line 86

If I can manage to sort that with the host, or you might be familiar with that error yourself, could I just ask about apply the Server Validation on both the form page AND thank you page?

I notice that you can't copy the server behaviour from the server behaviours panel, so do I just have to run through the validation setup again, on the thank you page?

Appreciate the help, thanks.
Nathon.

Ray Borduin
06-17-2009, 08:51 AM
You can't copy and paste because you are going from an asp to a php page. You would have to apply it again on the new page.

Nathon Jones
06-17-2009, 09:20 AM
Would I be right in thinking that Universal E-mail can't be run under sunone asp?

Ray Borduin
06-17-2009, 09:34 AM
You would be right that there is no gaurantee that it would work under sunone asp... but I think it probably could be configured to work properly with CDOSYS or CDONTS.

Nathon Jones
06-18-2009, 08:10 AM
I've added the validation to the thank you page, and it does appear to be redirecting back to my form page if it fails the validation. I also took your advice and used the Cookies Toolkit to re-populate the form (ta!).

How do I show validation errors though? When I'm returned to the form, upon fail, the user has no means of knowing which field is incorrect or, indeed, what the problem is.

Is this where the ASP/PHP relationship will cause problems?

Thanks again,
Nathon.

Ray Borduin
06-18-2009, 09:06 AM
Yes it is.

Normally that information is passed in the session and since you have two different server languages they use two different sessions.

I think the only option would be to put the error session variable value into the redirect url on the thank you page.

Then on top of the form page look for that url parameter and reset the session variable based on the Request.Querystring value.... so basically use the URL to pass and reconstruct session variables.