cancel
Showing results for 
Search instead for 
Did you mean: 

Expression to validate that a keyword contains a certain element as part of the value

Deanne_Devine
Star Contributor
Star Contributor

That was an overly complicated way of asking if there is a way to verify if an email submitted on a form is valid.

Here is the situation:

We collect information on a shared form. The information collected includes an email keyword that is used in the workflow for notifications, both in system events and ad-hoc tasks. When the email address is not formatted as an email address should be (basically, no @) the action fails and everything stops without an easily discernible (to the end-user) explanation.  It does generate a bug report, but it would be really nice if there was an expression that would validate whether or not the keyword contains the @ before the system tries to send out the notification. Then we could just display a nice message and ask the end user to check the email address and the end user wouldn't have to call for help.

I hope this makes sense! 

Thanks!

4 ACCEPTED ANSWERS

Ram_Kumar_Pula2
Confirmed Champ
Confirmed Champ

Hi Devine,

You can use a script that checks if an email provided is valid or not at the unity form level. If you are looking for something that validates when the form is submitted using regular expressions you can use this.

212b1bfe509f41efa4b0a8afbfcb8bab

 

You can replace %Vvalue with the email KW(%K000) and execute it.

 

Thanks,

Ram.

View answer in original post

Ram_Kumar_Pula2
Confirmed Champ
Confirmed Champ

Hi Devine,

If you want to validate at form level

1) Create 2 fields in the hidden section one for copying the value entered in the email field and other to write the value from the script (Valid/Not Valid)

2) Using custom action copy the email field value to the created field and execute a script when field not empty and get the value valid/not valid from the script.

3) If the script returns Invalid make the field as  invalidate using a custom action and display a msg something like "Please input a valid email address" 

NOTE: This validates only if the email maintains the standards for email format but not if this email exists or not? 

 

Thanks,

Ram.

View answer in original post

Deanne_Devine
Star Contributor
Star Contributor

I like both of these answers for different reasons - I think I will be able to use them for a lot of things in the future. If I want to check both the symbol (sorry, when I try to type it now, it brings up your names) and a '.') can I do both in one script with an &. Sorry I don't know the scripting very well. 

View answer in original post

Ram_Kumar_Pula2
Confirmed Champ
Confirmed Champ

You can look for both the "@" and "." in the same expression in work flow and in the same Script

 

96e7edf48544457a97fa31deea6bf673

 

Thanks,

Ram

View answer in original post

8 REPLIES 8

Ram_Kumar_Pula2
Confirmed Champ
Confirmed Champ

Hi Devine,

You can use a script that checks if an email provided is valid or not at the unity form level. If you are looking for something that validates when the form is submitted using regular expressions you can use this.

212b1bfe509f41efa4b0a8afbfcb8bab

 

You can replace %Vvalue with the email KW(%K000) and execute it.

 

Thanks,

Ram.

Deanne_Devine
Star Contributor
Star Contributor

THANKS! I will test this tomorrow, first thing.

How can I test this at the form level (if I might sneak another question in...)

Ram_Kumar_Pula2
Confirmed Champ
Confirmed Champ

Hi Devine,

If you want to validate at form level

1) Create 2 fields in the hidden section one for copying the value entered in the email field and other to write the value from the script (Valid/Not Valid)

2) Using custom action copy the email field value to the created field and execute a script when field not empty and get the value valid/not valid from the script.

3) If the script returns Invalid make the field as  invalidate using a custom action and display a msg something like "Please input a valid email address" 

NOTE: This validates only if the email maintains the standards for email format but not if this email exists or not? 

 

Thanks,

Ram.

Deanne_Devine
Star Contributor
Star Contributor

I like both of these answers for different reasons - I think I will be able to use them for a lot of things in the future. If I want to check both the symbol (sorry, when I try to type it now, it brings up your names) and a '.') can I do both in one script with an &. Sorry I don't know the scripting very well.