Can posted input values on onbegin
of ajax.beginform
be modified?
I have to modify values of some of the input fields after the form is submitted. But even if I change the values through js, at server side in request.form
I am getting the old values which were set initially at the time of form submit. How to get the modified values in request.form?
The code block is as follows:
<% using(Ajax.BeginForm("action", "controller",
new AjaxOptions{onbegin="funBegin",oncomplete="funComplete"})){
%>
<input type="text" id="txtName" name="txtName" value="gaurav"/>
<input type="text" name="txtAge" value="26"/>
<input type="submit" value="click here" />
<% } %>
<script type="text/javascript">
function funBegin() {
$("#txtName").val("gaurav pandey");
}
function funBegin(result) {
$("#divParent").html(result.get_data());
}
</script>
Now when I try to get request.form["txtname"]
at server side, I am getting "gaurav" instead of "gaurav pandey".