views:

276

answers:

1

hi friends, i have an form in which i have radiolist and set of text boxes and dropdownlist.now when i check an radio some textboxes will be disabled and some text box will be enabled .now i want to validate only the enabled text box and not the disabled one. in the same manner when i check other radiobutton i want to validate the rest of the text boxes.can some body help please.

some one give me the validation code for that.

A: 

If you can use jQuery then you can get the enabled text boxes using

$("input[type='text']:disabled")

and the enabled text boxes using

$("input[type='text']:not(:disabled))

If you want to use simple javascript then you can get all the textboxes, then iterate through them, check the type attribute for text and check the disabled attribute to true or false.

rahul