Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

User Entered Email Address Becomes Hyperlink

Avatar

Level 9

Is there a script that will change a user entered email address to a clickable hyperlink?

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

Something along these lines should work (click event of textfield):

if (this.rawValue !== null) {

     var vEmail = this.rawValue;

     var vSubject = "A Subject for your email";

     var vBody =  "Put your body message here...";

     event.target.app.mailMsg({

          bUI: true,

          cTo: vEmail,

          cSubject: vSubject,

          cMsg: vBody

     });

}

That should get you along the right lines,

Niall

View solution in original post

4 Replies

Avatar

Level 10

Hi,

If you set the font to an underline and then have script in the click event of the field, that uses the rawValue of the field. You would need to check in an if statement that the rawValue !== null.

Should work,

Niall

Avatar

Level 9

I'm sorry Niall, but I don't know what script to use.

Thanks

Avatar

Correct answer by
Level 10

Hi,

Something along these lines should work (click event of textfield):

if (this.rawValue !== null) {

     var vEmail = this.rawValue;

     var vSubject = "A Subject for your email";

     var vBody =  "Put your body message here...";

     event.target.app.mailMsg({

          bUI: true,

          cTo: vEmail,

          cSubject: vSubject,

          cMsg: vBody

     });

}

That should get you along the right lines,

Niall

Avatar

Level 9

Niall,

That works great - thanks for your time.

~Don