I have a form which is produced by a php script and consists of
2 radio button inputs (radio1 and radio2) and
one select input. I want to add code (javascript I guess) that when the user clicks on the 2nd radio input, the form reloads but with the select menu missing. The closest method i have thought of is to add a hidden input named "radio2_clicked" in the form and add an onClick event handler to the radio2 input, i.e.
Code: Select all
<input type=radio name=radio2 value=somevalue onClick="window.location.href=location.href;myform.radio2_clicked.value=1">
so when the form page reloads, the php script checks the value of the $radio2_clicked variable and if it finds it equal to 1 it doesnt output the select input element.
The problem with the above method is that the href property of the location object is undefined, probably because the form page is produced from a script. Is there any other javascript method I could use which reloads the same page but with the updated value of the $radio2_clicked variable? (e.g. the location.reload() ?)