I am a novice user of javascript and am trying to solve the following dilemma (I apologize if this is extraordinarily basic):
I have a form that has checkboxes on it. If the user changes the values of the checkbox (from either checked to unchecked or from unchecked to checked), I would like to pass that value to a URL. That's the easy part. Where I am running into trouble is I also want to create a hidden value that is passed to the URL as well, but ONLY if the value has changed.
I created a Hidden input type associated with the checkbox, but the problem is, these values always appear on the URL, no matter if the checkbox was changed or not. I only want that hidden value to pass if the checkbox was changed.
<FORM ACTION="form1.html" METHOD="post" NAME="form2">
<INPUT TYPE="checkbox" NAME="row" VALUE="Yes" ONCHANGE="checkbuttons()">
<INPUT TYPE="Hidden" NAME="row" VALUE="Hidden">
<INPUT TYPE="submit" VALUE="Submit">
I assume I need to create a function in Javascript called checkbuttons(), but that's where I'm stuck. Where do I go from here? Any ideas?
I have a form that has checkboxes on it. If the user changes the values of the checkbox (from either checked to unchecked or from unchecked to checked), I would like to pass that value to a URL. That's the easy part. Where I am running into trouble is I also want to create a hidden value that is passed to the URL as well, but ONLY if the value has changed.
I created a Hidden input type associated with the checkbox, but the problem is, these values always appear on the URL, no matter if the checkbox was changed or not. I only want that hidden value to pass if the checkbox was changed.
<FORM ACTION="form1.html" METHOD="post" NAME="form2">
<INPUT TYPE="checkbox" NAME="row" VALUE="Yes" ONCHANGE="checkbuttons()">
<INPUT TYPE="Hidden" NAME="row" VALUE="Hidden">
<INPUT TYPE="submit" VALUE="Submit">
I assume I need to create a function in Javascript called checkbuttons(), but that's where I'm stuck. Where do I go from here? Any ideas?