Board Logo

radio buttons help please.
shadiadiph - 3/26/2008 at 04:37 AM

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 - 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 - 3/27/2008 at 05:14 PM

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 - 3/27/2008 at 05:30 PM

you can just add another type to the list, say:

'alphanumspace': /^[ws]+$/,

Back to forum: