Avatar

Level 10

Hi,

I beleive validate() is a reserved method, so you should rename your function into validateObj() or so.

And when calling a function, the syntax looks like:

if ($.rawValue <> "2") then

     validateObj()

endif

In contrast to JavaScript FormCalc can only call functions which have been declared before the function call.

Just an example.

This script works, because the function is declared before it's called.

func alert(msg) do

          $host.messageBox(msg)

endfunc

if ($ < 2) then

          alert("value to small")

else

          alert("value ok")

endif

but this script fails, because the function call points to a function which has not be declared yet.

if ($ < 2) then

          alert("value to small")

else

          alert("value ok")

endif

func alert(msg) do

  $host.messageBox(msg)

endfunc