Hi,
I'm in a serious trouble.
I'm using jquery validator in my application.
In one of my form there are two different button like below .
<button id="uButton" name="uButton">Update Booking</button>
<button id="sButton" name="sButton">Save Booking</button>
Whenever I clicked on any of the button my validation methods being checked and i got the for submitted.
Up to this all is ok.
But what I want is - based upon which button click i want to sent a value in one of my hidden element.
<input type="hidden" name="hiddenElement" id="hiddenElement" value="" />
I want to set value 1 to the hiddenElement when someone clicked on the "Update Booking " Button
and I want to set value 2 to the hiddenElement when someone clicked on the "Save Booking" Button
I have tried to use onClick event like below -
<button id="uButton" name="uButton" onclick="setOperationType(1)">Update Booking</button>
<button id="sButton" name="sButton" onclick="setOperationType(2)">Save Booking</button>
<script type="text/javascript">
function setOperation(opType)
{
$("#hiddenElement").val(opType);
}
</script>
But the onclick function not called in this case (With Jquery Validator.) .
I have tried to use the submitHandler of the Validator but in the submitHandler method I can't get the buttonId which was clicked -
submitHandler: function(event)
{
}
Can somebody please guide me how i can overcome this situation ?
Thanks in advance for your kind information and help.