This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at support@mindscape.co.nz
|
When the user creates a Model with non nullable reference types (Guid, DateTime, Int), Updating an existing row by Posting no values for these fields results in a Valid ModelState with the default values for the types. Is there a way to get the ModelState to correctly reflect that IsValid == false since the user posted no values for the non nullable fields? We would like to display the {field} is required text when the user attempts to update a record with Null values in non nullable fields. |
|
|
Are you using the default MVC model binder or the LightSpeed entity model binder for unbinding from the form?
|
|
|
We are using the default modelbinder because the LightSpeed one ignores the bindInclude list. |
|
|
Assuming I am not missing something you should just be able to use ValidatePresence validations to cover this as that will tell you if a non default value has been supplied for the property. Because you are using the default model binder you will probably need to check Entity.IsValid through as I believe ModelState.IsValid will simply reflect if all bindings appears to work correctly.
|
|