change form element before submit with javascript -
in below code able alert message display correctly displaying message , number "3". know how use passes variable/number declare form element named "priority" passed form before submitting?
my goal use $_post["priority"]
, generate number 1, 2, or 3 based on link/button clicked.
<script language="javascript"> function submitform(priority) { alert("changing priority " + priority); document.frm.submit(); } </script> <a href="javascript: submitform('3');" class="ddm"><span class="label">low</span></a> <a href="javascript: submitform('2');" class="ddm"><span class="label">medium</span></a> <a href="javascript: submitform('1');" class="ddm"><span class="label">high</span></a>
add hidden field in form:
<input id='priority' name='priority' type='hidden'/>
before last form submit call, add this:
document.getelementbyid('priority').value = priority;
Comments
Post a Comment