In this section, we add “mailto:” links to our
ContactListView. Users of our application can then simply click on the e-mail address to send an e-mail, assuming that their web browser is properly configured to respond to
mailto: links. As discussed in Section 9.1, we can specify the URL for an anchor explicitly. Here is the modified version of our rendering method:
ContactListView>>renderContact: aContact on: html
html text: aContact name.
url: 'mailto:' , aContact emailAddress;
with: aContact emailAddress.
html text: ' ('.
callback: [ self removeContact: aContact ];
html text: ')'
Test this new component in your browser to see that your mailto: links are working correctly, see Figure 74.
Note that rather than manipulating strings in this way, experienced Smalltalkers might want to actually define an “email address” class to handle the different representations of email addresses. In fact, Seaside 3.0 already defines a class WAEmailAddress which may be used for this very purpose.