Link to home
Start Free TrialLog in
Avatar of sandsgaucho
sandsgaucho

asked on

submitting form with radio button

Hi,

Is it possible to submit a form using a radio button.. I tried various events such as onclick, onselect, onkeypress etc. but keep getting a Object doesnt support this property or method error.

thnx
Avatar of ndixon
ndixon

function submitFromRadio(el){

    if((el.tagName=='INPUT')&&(el.type='RADIO')){    //check the function was called by a radio button
      if(el.checked){                                                  //make sure the radio was checked
        el.form.submit();                                             //submit the form
      }
    }

}
<form>
<input type="radio" onclick="submitFormRadio(this);">

</form>
Avatar of sandsgaucho

ASKER

el.checked returns true but am still getting the same

"Object doesnt support this property or method error"

I have temporarily resolved the problem sending the parameters along with location.href but i really need to submit the form via a radio button..

thnx
Thats strange...

Are you executing anyother methods, maybe form.unsubmit, that would be triggered by this call?
ASKER CERTIFIED SOLUTION
Avatar of cwkhang
cwkhang
Flag of Malaysia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
yes, the last one works.. thnx!