c# - MVC Foolproof Validation RequiredIfFalse returning error incorrectly -
I am doing the dependency requirements using the MICC FULL PROFURE libraries:
< Code> public bool mandatory {received; Set; } [Expected ifTrue ("IsRequired", ErrorMessage = "This field is required")] Public int ifTrueSelectID {get; Set; }This works perfectly on the client side, allows me to submit the form without the
required IFTrueSelectID value (i.e. value 0), but
ModelState.IsValid return is incorrect, and with the following result in the immediate window:
myViewModel.IsRequired true ModelState [" RequiredIfTrueSelectID "]. Errors [0] {system. Web.Mvc.ModelError} error message:" One value is required. " Exception: Empty
I have to make sure that I am posting the value of the required value back i the elective selection (as you can see in the first immediate window query above) Why is the message "Need a value", and how can I suppress this error?
By the way, I am in MVC 5 5. May be that the
modelstate implementation has changed since the last update of FullProof 2 years ago? Does anyone else know about the library to be published recently, which works silly?
Controlling method:
[HTTP post] Public virtual function verification test (test vivmodel vm) {// breakpoint here to check modelstate See ISIG redie (VM); }
Oh, double your field is a value type.
Value types are always required if you want to be optional, you need to make the type faucet.
Note that the error message is not the same as the error message used in your legalization, this is the first sign
Comments
Post a Comment