Page 1 of 1

Required Fields defined by another field

Posted: Fri Nov 26, 2010 10:09 am
by longbo43
I have a form that has a huge number of fields on it. Well I think it is a huge number of fields.
I have been able to set certain fields as required.

But the client has now come back and asked that if a certain option is selected from particular dropdowns on the form other boxes will become required.

For example:

I have three fields a, b and c
a and b are drop down boxes.
a contains the options 1, 2, 3 - Is Required
b contains options 4, 5, 6 - Is Required
c is a text entry box - Is Not Required

At the moment c is not required but what the client wants is if a user selects option 1 from dropdown a then c becomes required but if option 2 or option 3 are selected c remains not required.

The client requirements could be that not just c but d, e and f become required.

Hopefully this explains what I am looking to do and hopfully someone can Help.

I'll also give you some info about me. I do not know or understand PHP. I used PHPRunner 5.2 to create the PHP for and any associated code.
I don't even know what to post here to help out but please request and I will make available anything that can help.

Cheers

Re: Required Fields defined by another field

Posted: Fri Nov 26, 2010 10:44 am
by Jonah Bron
I think the best way to approach variable requirements is with a multi-page form. If a input element may or may not be required, depending on the value of another input field, put it on the next page.

Re: Required Fields defined by another field

Posted: Mon Nov 29, 2010 3:54 am
by longbo43
Hi an thanks for your response.

How would I be able to do this as I am using PHP Runner to create my form. Also how would I call the subform (is that what it is??) and how would I set the variables to call it?

Cheers

Re: Required Fields defined by another field

Posted: Mon Nov 29, 2010 10:38 am
by Jonah Bron
I don't know anything about PHP Runner. Here's how it will work.

Code: Select all

Page 1
    display form
Page 2
    accept data from page 1, and store in session
    display form
Page 3
    accept data from session and page 2, and do something.
    display complete message