sivaprasad9394
Occasional Collector

Link Template Email Validation.

Jump to solution

Dear All,

I have to allow any number of white space infront and back of the email address.

Because email address is copied from the webpage and there is a chance of the white space added in leading and trailing of the email address.

To remove leading and trailing whitespace regx:

/^\s+|\s+$/g

How to add the condition in regx?

EmailValidation.png

Thank you.

0 Kudos
1 Solution

Accepted Solutions

You could try to create a value service that returns the trimmed address. That value could then be inserted into the form.

http://www.e-spirit.com/odfs51/Template-development/Rules/Connecting-external-logic-SCHEDULE/?commun...

But I'm not sure if this is a good solution because an ON_SAVE rule is not only called when you press the save button but many times before while you type. I'm not sure how it will behave if a rule tries to set the value of the form element you're currently editing.

View solution in original post

0 Kudos
5 Replies
pavone
I'm new here

Hello,

this should work:

<MATCHES regex="^\s*.+\@.+\.[a-zA-Z]{2,6}\s*$">

Best regards

Tim

0 Kudos

Hello Tim,

The new rule will allow email addresses with leading & trailing whitespaces, whici is ok to remove the error message from the form.

BUT what if still need the value of the email address field to be trimmed? So that further usage of those email addresses (with whitespaces) does not lead to runtime errors.

Is a Trim/modification of the field'S value possible with rules?

0 Kudos

You could try to create a value service that returns the trimmed address. That value could then be inserted into the form.

http://www.e-spirit.com/odfs51/Template-development/Rules/Connecting-external-logic-SCHEDULE/?commun...

But I'm not sure if this is a good solution because an ON_SAVE rule is not only called when you press the save button but many times before while you type. I'm not sure how it will behave if a rule tries to set the value of the form element you're currently editing.

0 Kudos

Hello,

do you need further help or did Tim's answer already help you? If so it would be nice, if you mark his "correct answer".

If you have already found solution by yourself it would be kind if you post it here.

Best regards

Michaela

0 Kudos

Hello Michaela Pahl,

Thank you for your reply.Tim answer is hepful.

Thank you.

0 Kudos