I am trying to create a from whereby inspectors are initially required to
enter a valid email address. As such I am trying to use a constraint to
check that the entry contains the @ character, but not sure how or if this
is the best way to do this.
···
Le lundi 14 juillet 2014 15:05:37 UTC, Paul Burland a écrit :
>
> Hi All,
>
> I am trying to create a from whereby inspectors are initially required to
> enter a valid email address. As such I am trying to use a constraint to
> check that the entry contains the @ character, but not sure how or if this
> is the best way to do this.
>
> Any assistance would be appreciated.
>
> Many thanks,
> Paul
>
···
On Monday, 14 July 2014 19:37:15 UTC+1, Mokpokpo ADJEODA wrote:
>
> http://opendatakit.org/help/form-design/binding/
> Regular Expression: Answer must be an email address like b...@aol.com
>
>
> constraint="regex(., '[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}')"
> jr:constraintMsg="this isn't a valid email address"/>
>
> Le lundi 14 juillet 2014 15:05:37 UTC, Paul Burland a écrit :
>>
>> Hi All,
>>
>> I am trying to create a from whereby inspectors are initially required to
>> enter a valid email address. As such I am trying to use a constraint to
>> check that the entry contains the @ character, but not sure how or if this
>> is the best way to do this.
>>
>> Any assistance would be appreciated.
>>
>> Many thanks,
>> Paul
>>
>
As others have indicated, what you are looking for is to use a regular expression; ie constraint='regex(...)'
Of course, the real issue is what is the proper regex for checking an email address? Well... that all rather depends on how precise you wanna get! If you want to be really pedantic about it, there's this:
Check out email regex if you want all the gory details. Basically, you will have to make a decision how precise you want your check to be - you can really go nuts trying to come up with a regex that'll accept 100% valid emails and reject 100% invalid ones...