#1 2017-07-03 16:10:18

svanneste
Member
From: Paris, France
Registered: 2015-05-27
Posts: 155

[SOLVED] Is the "IsEmail" action still working as before?

Hello,
Could someone check if IsEmail still works ? Some old code won't work anymore by me and new projects show an error.
It could be on my side.

The error is something, translated : "Exception thrown but not handled"

Thanks

Last edited by svanneste (2017-07-03 16:43:16)

Offline

#2 2017-07-03 16:13:39

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,633
Website

Re: [SOLVED] Is the "IsEmail" action still working as before?

Hello Samuel,

This works for me:

SetVar "[Email]" "some@email.com" "String"

IsEmail "[Email]" "[Result]"

If "[Result]" "==" "true"
  Alert "Information" "Yes; this is an email"
Else
  Alert "Information" "Nope; this is NOT an email"
EndIf

Offline

#3 2017-07-03 16:22:16

svanneste
Member
From: Paris, France
Registered: 2015-05-27
Posts: 155

Re: [SOLVED] Is the "IsEmail" action still working as before?

Hello David,
Thanks a lot for your quick reply. You are right in this case it works. What won't work on my side is when associated with the change event (sample attached).

Before some time (I don't remember when), I had to set the control's content inside a String and then I could check if that string was an Email (not directly from the control). Now I can't. Please, is it something I am doing wrong ?

MyApp.ab

Last edited by svanneste (2017-07-03 16:22:48)

Offline

#4 2017-07-03 16:36:38

svanneste
Member
From: Paris, France
Registered: 2015-05-27
Posts: 155

Re: [SOLVED] Is the "IsEmail" action still working as before?

EDIT : it still works with the Text control and not the Email one. smile

Many thanks David

Offline

#5 2017-07-03 16:39:07

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,633
Website

Re: [SOLVED] Is the "IsEmail" action still working as before?

Hello Samuel,

Certainly you find something curious (at least I don't know about this before). Apparently the Input Email control can store an "undefined" value if the email is not valid. This is similar to the Input Date control, which also do not store a regular string, but a Date variable. For that reason you get the error, because the validator library expect and string and not an "undefined" value.

You can change your code by this and see how is working. Note I set "false_2" just for your information:

VarIsUndefined "[Input2.Value]" "[VarIsDefined]"

If "[VarIsDefined]" "==" "true"
  SetVar "[Result]" "false_2" "String"
  Exit
EndIf

IsEmail "[Input2.Value]" "[Result]"

P.S. As you refer in your previous post, certainly, if we use an Input Text control, your code works as expected, because in this case the value of that control is an string, even when it's empty. So the validator library can deal with that string without problems.

Offline

#6 2017-07-03 16:40:25

svanneste
Member
From: Paris, France
Registered: 2015-05-27
Posts: 155

Re: [SOLVED] Is the "IsEmail" action still working as before?

Super big_smile
Thanks a lot again, David

Offline

#7 2017-07-03 16:41:36

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,633
Website

Re: [SOLVED] Is the "IsEmail" action still working as before?

Hello Samuel,

svanneste wrote:

Super big_smile
Thanks a lot again, David

Always thanks to you. We learn at least one thing new everyday! smile

Offline

Board footer

Powered by FluxBB


Copyright © 2017 DecSoft. All rights reserved.