imranb.modelbindingfix's People
imranb.modelbindingfix's Issues
Form values ignored under certain circumstances
Hi,
I'm having a case where model binding fails.
I'm posting the following fields to the server:
Request.Form.AllKeys:
{string[14]}
[0]: "__RequestVerificationToken"
[1]: "Images[0]"
[2]: "Parts[0].PartTypeId"
[3]: "Parts[0].PartManufacturerId"
[4]: "Parts[0].PartManufacturerName"
[5]: "Parts[0].PartId"
[6]: "Parts[0].PartName"
[7]: "Parts[0].PartYear"
[8]: "Parts[0].PartWeight"
[9]: "partSearch"
[10]: "BikeTypeId"
[11]: "Weight"
[12]: "Year"
[13]: "Description"
When the "partSearch" field is sent to the server, model binding fails.
It binds about half of the properties from Parts[0] resulting in a "PartTypeId required" validation error.
If "partSearch" is not part of the request, everything is fine.
Could this be a Bug in your BugFix?
Array with non-sequential indexes
Hello!
I am using MVC 4. On a page I want to enable user to make a list of objects (List<ConfigurationModel>) with ability of deleting any items. So, the form is built using JavaScript and resulting HTML can be the following:
<input name="Configurations[2].Color" type="text" value="111111" />
<input name="Configurations[2].Size" type="text" value="S" />
<input name="Configurations[3].Color" type="text" value="222222" />
<input name="Configurations[3].Size" type="text" value="M" />
<input name="Configurations[7].Color" type="text" value="333333" />
<input name="Configurations[7].Size" type="text" value="L" />
The user added 7 items but then he removed [0], [1], [4], [5] and [6]. The form is binded correctly in regular MVC action if I use the following workaround:
<input type="hidden" name="Configurations.Index" value="2" />
<input name="Configurations[2].Color" type="text" value="111111" />
<input name="Configurations[2].Size" type="text" value="S" />
<input type="hidden" name="Configurations.Index" value="3" />
<input name="Configurations[3].Color" type="text" value="222222" />
<input name="Configurations[3].Size" type="text" value="M" />
<input type="hidden" name="Configurations.Index" value="7" />
<input name="Configurations[7].Color" type="text" value="333333" />
<input name="Configurations[7].Size" type="text" value="L" />
But it doesn't work in ASP.NET Web API... even if I use your fix...
Please document what issue this package fixes
Saying "it fixes a model binding issue" tells me barely anything. It does not allow me to check if it is fixed with the package, or if it is actually an issue without this package or if I can safely remove the package.
License clarification
Hi,
Please add a license file. Thanks.
https://help.github.com/en/articles/adding-a-license-to-a-repository
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.