Pages

Wednesday, May 18, 2011

Adding a hyperlink to a form using an IFrame

There are a number of ways to add a hyperlink to a form. You can create a custom field and convert that into a hyperlink. However an arguably better way is to use an IFrame since you can save on having to modify the schema by doing so.

Using an IFrame is not complicated, but one thing I struggled with a little was to give the link a nice underlined blue color as is standard for hyperlinks. Without formatting, the hyperlink will just appear as text in the form without any visual indicators that it is a hyperlink (other than when you hover over it the mouse pointer will change to a hand) as shown below:



Other than creating the IFrame as recommended in the screenshot below:


The only other requirement is to add the following somewhere in the jscript of the form onload event:

crmForm.all.IFRAME_RatePlan_d.innerHTML ="<a href='www.someurl.com'  target=_blank>Rate Plan Summary</a>";

I am not sure if this is the only way to go about it (I somehow doubt it), but in order to get the nice underlined blue hue, all you have to do is add the syntax highlighted below:

crmForm.all.IFRAME_RatePlan_d.innerHTML ="<a href='www.someurl.com' style='color: #0000ff; border-bottom: 1px solid #0000ff' target=_blank>Rate Plan Summary</a>";

And then it will render like this:


Perhaps a small tweak but a big difference as far as user experience is concerned.

No comments:

Post a Comment