Inserting Custom HTML Code

Html code before/after control

HTML inserted before and after the control in the generated HTML page. Must be a single line of text. For example, suppose you want to add a help icon that displays a tooltip.

graphics/HtmlCodeExample.png

A simple way to implement field-level tooltips is to put this HTML in the Html code after control attribute:

<img src="help.gif" title="Tooltip text goes here">

This inserts a help icon that displays a tooltip when a user points to the icon.

A more generic approach would be to write a javascript function in CustomCode.js that returns a string of HTML.

function getHelpIcon ( tooltip ) {
     var str;
     str = '<img src="help.gif" title="' + tooltip + '">';
     return str;
}

The Html code after control would then call this function to get the HTML:

<script type="text/javascript" language="javascript">document.write(
     parent.objCustomCode.getHelpIcon( 'Tooltip text')
);
</script>

You must declare your function in CustomCode.js. Look for the public declarations at the bottom of the file, and add this line:

     this.getHelpIcon = getHelpIcon;

Notes

In the Html code before/after control attributes, you can use the string %fieldname% to refer to the name of the control. (The name of a control is the value of the name attribute on the form element.) For example, you could pass %fieldname% into the getHelpIcon() function, which would then return the help for that field.

Related Topics

Using Field Variables