shadiadiph
Junior Member
Posts: 2
Registered: 3/25/2008
Location: Thailand
Member Is Offline
|
| posted on 3/26/2008 at 04:37 AM |
|
|
radio buttons help please.
I am using the validator.js however I can't seem to work out a way to do this.
I have a form page that has a question with two radios with the values yes and no if yes is selected then a text input is required in a text field
input if no is selected them it is not required. Does anyone have any ideas on how to use the validator.js to do this?
Thank you
|
|
|
tigra
Administrator
Posts: 1984
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 3/26/2008 at 03:05 PM |
|
|
if you replace value 'no' with the empty string ''
then you should be able to use 'r' (required) key to make sure 'yes' is selected.
You can also use checkbox in this case.
|
|
|
shadiadiph
Junior Member
Posts: 2
Registered: 3/25/2008
Location: Thailand
Member Is Offline
|
| posted on 3/27/2008 at 05:14 PM |
|
|
hi tigra
thanks i will try that and let you know how i get on.
is there anyway to make the 'alphanum': /^\w+$/, work so it will accept spaces?
thank you
|
|
|
tigra
Administrator
Posts: 1984
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 3/27/2008 at 05:30 PM |
|
|
you can just add another type to the list, say:
'alphanumspace': /^[\w\s]+$/,
|
|
|