Wednesday, June 16, 2010

Calling custom Javascript.

Sometimes, you just NEED to call a custom Javascript function...
If so, you can do the following:

Of course you save the Javascript function in a seperate file.
Include that file using:
<trh:script source="../skins/script/accessibility.js">

For this, include the following namespace to your jsp:root tag:
xmlns:trh="http://myfaces.apache.org/trinidad/html"

Place a commandToolbarButton (or some other component) on the page:
<af:commandtoolbarbutton partialsubmit="true" text="A" id="pt_cl6">
<af:clientlistener method="changeFontSize" type="action">
</af:commandToolbarButton>

Assuming there is a function called changeFontSize, this will be executed when you click the button.

1 comment:

  1. It is easier to just use the ADF "resource" component instead of the Trinidad component. Just use <af:resource type="javascript" source="/scripts/accessibility.js"/>

    ReplyDelete