Jump to content

Strange problem with form validation


Sharkadder

Recommended Posts

Hi, my sign up form it has all of a sudden stopped working as asked, the form is a html form and validated in javascript. Last time i checked the form was a few weeks ago and it was working perfectly, all of a sudden it is only half working, here is what is happening.The user types in some data into a form and hits the submit button, at that point a check is made with javascript to check that each field has passed certain validation, e.g. character length, in the right regular expression format etc.Ok when the check is made, with correctly typed fields the border changes to green, with incorrect typed fields the border changes to red, so that is all working fine.Now in addition to the borders changing, an alert box is meant to appear saying what the nature of the error is e.g. "your password is an invalid length", but it doesn't show.I have in no way what i can recall modified this javascript code, i have been looking into it and i cannot see what the problem is. More to the point as well, i also have a php form validation behind that to do an extra check, for some reason that validation isn't working either, infact it just totally skips the whole php validation out and says "sign up complete etc.".Anyways I'm not here to talk about that, i am here to talk about the javascript one, i can sort the other out afterwoods. Now i changed the "onsubmit" action for the form to display a message box if a check box isn't ticked, that worked fine, but when i try returning my validation for all fields it's just not displaying the alert box.My code is quite lengthy, i have not uploaded any now, would it be ok if i upload my code for you to take a look at? Also if it's easier, you can find the sign up page by visiting the following url and viewing page source:www.satmedics.com/signup.phpThe import functions you need to look at are:validateformfieldnamegoeshere //<--where formfieldnamegoeshere is the actual field name on the formvalidateonformsubmit(form1)And the html form itself.Don't worry if you press submit and it submits saying "thank you etc.", the actual submitting procedure doesn't take place, i commented it out for testing purposes.As i say, it was working fine a few weeks ago, any idea's why my alert box displaying the "reason" for not completing sign up isn't displaying?

Link to comment
Share on other sites

There is no validateSetup() function and no form1.setup element. When validateFormOnSubmit() gets to that call, the function immediately terminates with an error. So it never gets to the alert.You could have spotted that just by looking at your Firefox Error Console.

Link to comment
Share on other sites

hmmm, i must of deleted that by accident one time, i cannot remember doing that though.thanks for the answer anyways, i'll look into how i can input these setup functions into practiseEDITi know what it was, in my reason i was telling it to display a function for a form element that didn't exsist, that form element got deleted earlier today, i must of missed it off. I then removed the reason for that function and form element, re-ran the form, the validation works and all is good.thanks, it was silly error on my part.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...