Passing dynamic parameters to the Java Script method in a Fusion Web Application

In this post, I'm sharing some tips to pass dynamic parameters values to a Java Script method. The idea is inspired by an example from Frank Nimphius. Solution is to use <af:clientAttribute> to associate the parameter and value with the component which triggers the event. When using af:clientAttribute the parameter can be accessed on the client through AdfUIComponent.getProperty("ParameterName"). The rich client framework takes care of marshaling the attribute value to the client. Also, the below code uses 'closure' in the JavaScript method to ease the coding.

 <af:resource type="javascript">  
  function someMethod(arg) {  
    return function (evt) {  
       var finalArg = evt.getSource().getProperty('SomeDynamicArg') + ' : ' + arg;  
 <af:commandButton text="SomeActionBtn" id="cb1">  
  <af:clientListener type="click"  
  <af:clientAttribute name="SomeDynamicArg"  


Post a Comment