A common subfile column for customer or personnel data is an e-mail address. Using the ProfoundUI Rich Display, you can make the address a hyperlink that when clicked will open your e-mail client with the “send to” populated. In this example, we added a grid to the canvas for a simple three column subfile. First Name, Last Name and E-mail Address make up the data we’re going to display.
For the E-Mail Address column, we added a hyperlink widget. We bound the “value” to a field called EMAIL. We also bound the property “hyperlink reference” to a field as well called LINKREF. When the RPG program populates those fields, we would do the following:
EMAIL = 'firstname.lastname@example.org'; (this is the text to display in the subfile)
LINKREF = 'mailto:email@example.com'; (this is the hyperlink reference)
Note LINKREF uses the “mailto:” as the leading characters, followed by the e-mail address. When our program runs, you see the e-mail address is a hyperlink. When you click on the link, it opens the mail client with the address pre-populated.
You could set the LINKREF to include the subject and some message text as well: LINKREF = 'mailto:firstname.lastname@example.org' + '?subject=Records Update&body=Your account has been updated';
You may also do this using an output field instead of a hyperlink in the subfile column. CSS classes may be use to style it anyway you like for display. To open the e-mail client, add code similar to this to the “onclick” event of the EMAILTXT field. Use the getObj api to pull the value for the address. Then use pui.link to construct your mailto statement. You may even add a subject line.
When you click on the e-mail address your client results would look like this:
For more information on field binding, take advantage of this link:http://www.profoundlogic.com/docs/display/PUI/Field+Binding
And to learn more about the “onclick” event, follow this link: http://www.profoundlogic.com/docs/display/PUI/onclick+event