Like this article? We recommend
Calling the Script Function
Now that we’ve defined our JavaScript function, we need to call it. The key is the expr attribute. We’ve already seen the expr attribute used to play back the value of form variable, as follows:
The value you entered is <value expr="field1"/>
The good thing about the expr attribute is that it can also contain any valid JavaScript expression. Once we get the values we need (v1 and v2), we trigger the function call using the following:
<prompt> The product of <value expr="v1"/> and <value expr="v2"/> is <value expr="multiply(v1,v2)"/>. </prompt>