0

I'm using autoNumeric to reformat numbers on my form. My form loads previously entered data, allowing the user to update information on the form, overwriting the previous data. The user can change information on that page that removes values from some autoNumeric fields. But, when the form submits the previously values are being saved still.

I'm using jquery to remove values:

$(".SqFt").val([]);

And hide inputs:

$(".PropertyType").hide();

I have a Save button and a Submit button. The save button works as intended. Clicking save calls some javascript that unformats the numeric fields, the submits the form:

$("#Save").click(function(){
    unFormatAutoNumeric();
    $("#MyForm").submit();
})
$("#Submit").click(function(){
    unFormatAutoNumeric();
})

If I check the values of the fields on submit, $("#OfficeSqFt").val() for example, they are empty. But when I check the model values in the controller it shows the previously entered value. The submit button does the same unFormatting as the save, but instead of calling $("#MyForm").submit() it just let's the form submit from the button click. I was able to add $("#MyForm").submit() to the submit onclick, and it now posts correctly.

My question is why do the null values properly post with $("#MyForm").submit(), but the previously entered values post from the html form handler?

Any help understanding what's happening here would be appreciated.

Jim
  • 58
  • 1
  • 5

0 Answers0