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
|
How can you set validation on an email field to also allow it to be blank? At the moment I have ValidateEmail=True, ValidatePresence=False and IsNullable=True - its bound to a winforms textbox and when its blank I get 'Invalid Email'. I expect it would work ok if it was a null, but in this case its an empty string. Any ideas? |
|
|
Same here. How to allow blank email address? |
|
|
Hi guys, The framework ValidateEmailAddressAttribute has an optional isRequired argument which you can use to allow the email address to be omitted. At present, [ValidateEmailAddress(false)] still won't permit empty strings, only nulls. I've committed a change for this, so beginning with the 2 July 2009 nightly build, this will also permit empty strings, which should solve the data binding issue. Note that [ValidateEmailAddress] (without an argument) defaults isRequired to true which will still NOT allow nulls or empty strings. At present, the designer does not provide a way to set the "is required" option. Again, this is fixed in the upcoming nightly. To set "is required" to false in the designer, go into the LightSpeed Model explorer (View > Other Windows > LightSpeed Model), drill down the tree to the entity property, open the Validations node, and select the Email Validation node. You will now be able to set Is Required via the Properties box. Again, the default is IsRequired=true. KiwiRod - sorry this took so long to happen - we had wanted to discuss the impact of the change before making it, but the discussion got put off and the issue fell through the cracks. I hope this hasn't been too major an inconvenience for you. |
|
|
Thanks Ivan :)
|
|