Validation

Discussion in 'JavaScript' started by schmoose, Apr 7, 2008.

  1. #1
    Hi I have a page with two forms. Both the forms have radio buttons. I am successfully validating that both forms have at least one radio button selected - this is no problem but in the second form i have one or more text boxes a user needs to have filled in if the radio button is selected.

    For example -

    radio 1 text 1.1 text 1.2
    radio 2 text 2.1
    radio 3 text 3.1

    I need to make sure that if a user has radio 2 selected they have filled in text 2.1 before the form is accepted.

    to make matters worse radio 1 has 2 text boxes and they both need enties to validate ok. Any help appreciated.

    Thanks

    Rob
     
    schmoose, Apr 7, 2008 IP
  2. temp2

    temp2 Well-Known Member

    Messages:
    1,231
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    150
    Digital Goods:
    2
    #2
    if( radio2.selected && trim(text21.value) == '' ) alert('U must fill text 2');

    // something like that :)
     
    temp2, Apr 8, 2008 IP