AI OnAI Off
Hi Mattias,
Not seen this before, but it looks like it's because the string is empty. If you look at the IsValid method for the EmailAddressAttribute you see it returns true if null (but doesn't have any special handling for empty strings):
if (value == null) {
return true;
}
I think the easiest fix would be to lift the EmailAddressAttribute from Alloy and add in a string.IsNullOrEmpty()
, then use that custom email attribute.
/Jake
When a string property is decorated with an EmailAddressAttribute validation fails when removing the address. This occurs on a fresh Alloy site with all the latest updates.
How to reproduce:
Here validation fails with: The Email field is not a valid e-mail address.
Sent via Dojo to the server in the post body is: {"id":"113_116","properties":{"email":"\"\""},"action":513}
As an editor this can be worked around by leaving the property blank, switching to another property and changing that after which validation succeeds and nothing is sent for the property.
Is this a known bug? Is there a fix available?