I want to either remove 2 hidden fields or set them to null in a form before a POST action is performed using onclick event on a checkbox.
This is what I have –
<input type="hidden" id="ci" name="ci" value="2"/>
<input type="hidden" id="pg" name="pg" value="prev"/>
<form:checkboxes path="choices" items="${lookups}" itemValue="id" itemLabel="label" element="li" **onclick="this.form.submit();"**/>
How do I modify my onclick event JS to support this ?
Thanks!
Simply change the
onclickto this:You just have to use the ID of the elements then assign their value to empty string – this will still send value though. To disable any value, disable those elements: