• form validation problem = easy??

    Home » Forums » Developers, developers, developers » Web design and development » form validation problem = easy??

    Author
    Topic
    #393270

    I have a set of radio buttons with 3 possible values to be assigned to them. i want to capture the event where a user doesn’t click on the radio button group at all and am having trouble getting my javascript to work. I have tried various iterations of If Then…Else and the Switch statements but nothing seems to work. At bottom, I’d like to just test for the radio button having no value (rather than mucking about with testing whether the button has a value) as that is the most straitforward way to validate. (If they select a choice I don’t care; it’s only when they don’t that I am interested).

    Anyhow, this doesn’t work:
    function validateForm(form){
    if (form.RecipientType.value == “”){
    alert (“You must select a recipient type!”)
    form.reset()
    return false
    }
    return true
    }
    //–>

    I have looked into things like testing to see if a form element is ’empty’ that is, not assigned a value and tried Undefined and NaN but neither test seems to work. Any ideas on how to test that a form item has no value assigned to it in Javascript?

    TIA

    NEVER MIND!

    Figured it out.

    Reply To: form validation problem = easy??

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: