Closed janamargaret closed 7 years ago
I would model bind to a Newtonsoft JToken, which gives you the posted data (see https://stackoverflow.com/a/37045229/2086). Then you need to validate that against your 'metamodel' - that is the information that you used to build the PropertyVm[]
.
Does that make sense?
It does, yes. I suppose assuming there was already something in the library to accomplish this bit was asking a bit much :) Thank you.
It's interesting to think how this might work as part of the library. It's impossible to make a binder for PropertyVm[] as it would need to access the database to build the Vms for the request, but there could be a Bind(JToken jt, PropertyVm) thing somewhere.
I'm attempting to implement the method below described on http://formfactoryaspmvc.azurewebsites.net/, but I can't figure out if the library already has the ability to perform server-side validation without a pre-built view model to map to on form post.
So I'm using my back-end code to build an array of
PropertyVm
objects, and then calling.Render()
on that array to build out the form HTML. That part is working splendidly. However, when I hit the form submit button, I'm not sure how to identify the inputs and values and validate them against the same database-driven rules I used to generate thePropertyVm
array I used initially.Before I dive too deep into coding my own solution, I thought I'd ask if maybe there's something already pre-baked into FormFactory that I'm missing in the shuffle. Thank you!