I have a form with the autocomplete
attribute set to off
.
Inside this form there is a hidden input element (generated using the ASP.NET MVC Html.HiddenFor()
method, but this should be irrelevant):
<input type="hidden" value="0" name="Status" id="Status" data-val-required="The Status field is required." data-val-number="The field Status must be a number." data-val="true">
When the form is submitted, this value is incremented by one, and the model returns to the view. If I write the status value on the page, I see that the value has been correctly increased.
However, this hidden input field is always cached. He never gets the right meaning. I tried to set the autocomplete
attribute directly on the input element, but without success.
How can I get this hidden field to get the correct value? I would prefer not to use Javascript.
Edit : providing more code ...
controller
//This code is being executed, and the status is being incremented. shippingOrder.Status = (shippingOrder.Status != (int)OrderStatus.Closed) ? shippingOrder.Status + 1 : shippingOrder.Status;
View
@using (Html.BeginForm("Number", "Order", FormMethod.Post, new { id = "orderSummary", autocomplete = "off" })) { ... @Html.HiddenFor(m => m.Status) }
source share