Closed luizfbicalho closed 6 years ago
@luizfbicalho a great deal has changed since 4.0 and the previous behaviour was simply incorrect. You've got a form that unconditionally submits data for ListValues[]
(an alternate name for the first entry in the ListValues
collection). If the user hits "Submit" without changing the form field, the submitted value is empty and model binding converts that to a null
entry in the collection.
It's not possible to revert to the earlier behaviour.
Ok, I understand.
Let me change the question:
How can I pass the inputs to get the Empty list? It's important to me to have different values for empty list and nothing, because if I pass nothing, I get the list from the server, if I pass an empty list, I clear the list from the server.
Thanks
@luizfbicalho it's probably better to add a checkbox for the "delete all" case. That way, users don't need to clear multiple entries.
Separately, your action should ignore null
entries in the collection. Or, you could do something nifty with JavaScript (or an additional round trip to the service) and add new entries when the user clicks a button. Then you could require the new field to be filled in.
Thank you for your feedback. We're closing this issue as the questions asked here have been answered.
I have this code in my mvc razor page
and this code in my controller
In the previous version (4.0.30506.0) my object received was this after the submit
And now the value that is received in 5.2.6 is
How can I change it back to the 4.0 result?