Skip to main content


 

The following is a guide to executing custom JavaScript or jQuery code on a SmartForm or View via rules.

 

 

 

- Create a Data Label control, checking the 'Literal' property and unchecking 'Visible'.

 

 

 

    10820i6D32B3327236311C.png

 

 

 

- Open the Expression Editor on the Data Label, and insert your JavaScript wrapped in <script></script> tags.

 

 

 

    14321i336EF8590475AD19.png

 


- Create a new (unbound) rule by clicking 'Add Rule' and add two 'Transfer Data' actions.

 

 

 

    15887i4042746B7A4E4B14.png

 


- Transfer data: Check the literal Data Label but leave the input blank.

 

Note: This clears the Data Label, which is necessary for injecting scripts.

 

 

 

    11979i24824B47EA6B3D66.png

 


- Transfer data: Check the literal Data Label and drag in the JavaScript Expression.

 


    16350i52827A97B98DD300.png

 


- Give the rule a name and click 'OK'

 

 

 

You can now execute your JavaScript via rules by using the 'execute another rule' action.

 

 

 

    15014i75EE3004072B3F1A.png

 

 

 

To start your script after form data loads, place this rule at the end of a 'When the Form/View executed Initilizing/Initialized' rule.

 

 

 

Hope this helps.  If this post was helpful, please give it a 'thumbs up' to improve visibility.

 

- Jonathan



 

Hi Jonathan,

 

Your post is very use full.

 

However, i face some problem with that.

 

I create a view and execute some javascript. It works fine in the view.

 

When i insert the view into the form, it just not working.

 

Anything else i had missed out?

 

Thank you.


Reply