Reputation: 2571
I have two radio buttons like this,
<table name="">
<tr><input type="radio" name="passwordissues" value="forgetpassword"/>Forget Password</tr>
<tr><input type="radio" name="passwordissues" value="resetpassword"/>Change Password</tr>
</table>
I may can put this inside a form but i am not supposed to add any buttons to submit the form.
My problem is when ever i click on one of the radio button it has to perform some action or has to display something. How can achieve it..
Upvotes: 0
Views: 894
Reputation: 94645
You have to write JavaScript
handler (event function) for radio buttons that invokes the form.submit().
Sample:
<script type="text/javascript">
window.onload=function(){
var radios=document.getElementsByName("passwordissues");
var form1=document.getElementById("form1");
for(i=0;i<radios.length;i++){
radios[i].onclick=function() { form1.submit(); };
}
};
</script>
<form method="post" action="action_here" id="form1">
<input type="radio"
name="passwordissues"
value="forgetpassword"/>Forget Password
<input type="radio"
name="passwordissues"
value="resetpassword"/>Change Password
</form>
Upvotes: 1