Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

How can create script for Is Valid Email ( the mail )


This topic is 1495 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

Hi all,

I would like to create a script or function for the Email field in case the entry of the email without @ give him an error or an invalid address.

 

thanks a lot for any help or support :) 

Posted

You could do a trigger OnObjectSave. The script would use this custom function https://www.briandunning.com/cf/360 and show a dialog. You could just use this part of the CF: 

Left ( yourEmailField ; Position ( yourEmailField ; "@" ; 1; 1 ) - 1 ) ;

Or, you could really go for it and use SendGrid's API to validate the email is real. https://sendgrid.com/docs/api-reference/ Email Address Validation.

Posted

Actual I created function but while filling the field correct e-mail give me No. 1 instead of e-mail.

 

945687734_correctemail.png.d4af104a5849c71aa861f2227a5e1fd2.png

 

the result :) 

 

1.png.ff752719f49a4b7d91acd2dcd3fa10b6.png

Posted (edited)

I suggest you start with something simple: validate the email field using a calculation =

PatternCount ( Self ; "@" )

This will produce a validation error when you try to commit a record where the email field does not contain the @ character.

Now, this simple solution has several flaws:

  1. It fires on record commit, not when user exits the field;
  2. The error message can be cryptic and confusing to the user;
  3. There are many other ways in which an email address can be invalid.

To solve the first two problems, you can attach an OnObjectValidate script trigger to the field and have it run a script along the lines of:

If [ not PatternCount ( YourTable::Email ; "@" ) ]
  Show Custom Dialog [ "The email is not valid." ]
  Exit Script [ Result: False ] 
End If

IMPORTANT
Script triggers work only on layouts where they have been installed. If you want to ensure data integrity, use the script trigger in addition to field validation, not instead of it.

The third problem is much more complicated and I won't go into it now.

 

Edited by comment
Posted

I created as per mentioned but unfortunately still if e-mail correct given me No. 1  :(

Posted

Your are super FM is working fine in future I will update  :) Please I hope to visit this link :

 

This topic is 1495 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.