...

View Full Version : Creating a form with some answers requiring different sub answers



t-buck
10-31-2007, 11:43 PM
I'm not sure if this should be under this category or the javascript category. But I want to do a simple registration form, but certain fields are required based on their answers in the form.

For example, if they click the radio button member, then they only need to fill out 2 of the 5 fields. If they click non member the form needs to require them to fill out everything.

How would I go about doing this?

vtjustinb
11-01-2007, 03:25 AM
The easy way to tell what the solution is would be to consider "is what I'm trying to do content, structure, presentation, or behavior?" Content is pretty much basic HTML, structure and presentation typically lies under CSS, and behavior is almost always Javascript.

But yes you would want a Javascript approach. The easy algorithm would be in your validation function (which would be fired from the onsubmit from the form) to check those radio buttons to see which one is selected, and require different forms depending on what's active.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum