Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Form Validation using Custom Thread Fields
leefish Offline
Hamster
*****
Posts: 1,009
Joined: Apr 2010
Post: #1
Form Validation using Custom Thread Fields
Hi

I am building a form in my prefix_newthread template using XThreads custom fields, and I am a bit stuck on the validation of the form.

I have a select box (values are Yes or No). Default value is No, div id is "cerem". When the value YES is selected then another div on the page (div id "cerem2") opens showing a second select box(values 0,1,2). (It would be nice to be able to CLOSE that div if they then choose NO after all, but thats a nice to have, not a must have).

The idea is if the answer NO is inputted then the user should not choose a number. But they can still choose a number with NO selected.  What I would like is that when the user submits the form then if there are combinations such as

No and a number greater than 0
or
Yes and 0

that the page will not submit but instead will give an error (like the error we get if we try to upload an invalid attachment).

This combination of Yes and No (with different ids) occurs 4 times on the page -

Is this possible? If so, can anyone give me some pointers on how to achieve this? I have added a picture of the form....


Attached File(s) Thumbnail(s)
   


[Image: leelink.gif]
MYBB1.6 & XThreads
02-27-2011 05:14 AM
Visit this user's website Find all posts by this user Quote this message in a reply

« Next Oldest | Next Newest »

Messages In This Thread
Form Validation using Custom Thread Fields - leefish - 02-27-2011 05:14 AM

 Standard Tools
Forum Jump: