Skip to main content
boloco
Known Participant
July 15, 2009
Question

Spry Validation

  • July 15, 2009
  • 2 replies
  • 690 views

Hi there,

I am trying to use the spry validation in my form. But that form has already a server side validation in the form element.

When I try to insert the spry validation for a text field for example I have this error message:
"While executing inspectSelection in spry_ValidationTextField.htm, a JavaScript error occurred."

Does it mean that I cannot put a Spry validation after I've inserted a PHP validation?

What am I doing wrong?

Help me please.

Thank you!
boco

boco

This topic has been closed for replies.

2 replies

Lawrence_Cramer
Inspiring
July 18, 2009

Having both client side JavaScript and server side validation is a good "belt and suspenders" tactic, especially if you are making sure the right kind of data is submitted to avoid errors on the database. Trying to mix your validation within the form itself could get messy however. You might want to try this...

Have all the Spry validation in the form to "pre test" your data before it's ever submitted. This will catch 95% of the problems.

If you really want to be 100% sure, you can include a block of server side validation on the target page for the form before you process any of the data. If any of the data fails you send the user back to the form, re populate the form with the form variables they sent the first time and display an error for the field that failed.

Sorry, this isn't as simple of an answer as you may have been looking for, this requires quite a bit of coding, but it's a 100% sure way to validate the data before writing it to your database.

Hope this helps.

--
Lawrence   *Adobe Community Expert*
www.Cartweaver.com
Complete Shopping Cart Application for
Dreamweaver, available in ASP, PHP and CF
www.twitter.com/LawrenceCramer

DwFAQ
Participating Frequently
July 15, 2009

Just hand code the validation into the page and it should work.