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
|
Hi Using Lightspeed with MVC3. I have an entity with a non-nullable int property. Previously the user had to supply a value for it, now it's ok for the user to leave it blank in which case it will get the default value of 0 (zero) from the database default value. I'd prefer not to set the property to nullable. How do I tell Lightspeed not to validate the property for form submits? Thanks. |
|
|
Check if you have Validate Presence enabled for that property as that would raise a validation failure if a default value (e.g. 0) is supplied.
|
|
|
Hi Validate Presence is set to false. |
|
|
What error are you seeing?
|
|
|
No error, but the form won't submit due to "must be a number" validation being applied to the empty field. |
|
|
Gotcha - this sounds like it is JavaScript based validation running in the browser and not a validation occurring on the entity as such. What are you using to apply client side validation for the form?
|
|
|
Ahhh, right. I was using @Html.TextBoxFor to generate the field. I've changed it to a manually coded input and now don't get the validation issue. Where is @Html.TextBoxFor getting its validation policy from though? The Lightspeed model? |
|
|
My guess would be its most likely getting it from the property being a non nullable int leading it to assume numeric validation. Its possible this might be being picked up by any DataAnnotations as well if you have any applied?
|
|
|
No DataAnnotations - must have been the non-nullable property. Thanks. |
|