Hi,
I would like to return an error if the user inputs some text instead of email.
I have the below regex and textField. Can someone guide me how to link these two to perform the required validation.
regexmatch( pattern: "^[A-Z0-9\'\+\&\%_-]+(\.{0,1}[A-Z0-9\'\+\&\%_-]+)*[@]{1}[A-Z0-9.-]*[A-Z0-9-]+[.]{1}[A-Z]{2,6}$", searchString: ri!employee.email, regexFlags: "si")
a!textField(
label: "Email",
value: ri!employee.email,
saveInto: {ri!employee.email},
inputPurpose: "EMAIL"
)
Discussion posts and replies are publicly visible
In addition to what Stefan suggested: i would strongly suggest you encapsulate such basic functionality as email address validation into a reusable Expression Rule, rather than hardcoding it onto any interface.
Is there a way, I can link the regex and expression rule and perform email validation.
You put that regex into an expression rule and call this in the validations parameter of your text field.
I don't have Regular Expression Plug-in, so not sure if I can use the pattern which I am talking.
Then install that plugin from the admin console.
You can also do a more simple check. E.g. just check for the existence of a @ and a dot. This would not require any plugin.
Not only @ , dot. I have to check at least few characters between @ and dot and few characters before @.
That would be a very simplified check.
a!forEach( items: { "this.is.my.email@example.com", "invalid.org", "missing.top.level@appian" }, expression: like( fv!item, "*@*.*" ) )
I have modified little bit, not it is working as per my requirement. Thank you so much for your help.
a!forEach( items: { "email@example.com", "invalid.org", "missing.top.level@appian", "swapna@.", "swapna@a.c" }, expression: like( fv!item, "?*@?*.?*" ) )
Like Mike I still strongly recommend using the regex or the people functions plugin.