jeroen muskee wrote:
OK, I started off with a simpler example, just an addition of 2 numbers.. I know this should be pretty close to the correct setup by looking at other Javascript examples, but it just does not work jet. Any suggestions
\startJSpreamble {Calculate} used now function Calculate () { v = getField("textC") ; v.value = 0 ; v.value += AFMakeNumber(getField("textA").value) ; v.value += AFMakeNumber(getField("textB").value) ; v.value = 9999 ; } \stopJSpreamble \setupinteraction[state=start] \setupfield [lineABC] [label,frame,horizontal] [frame=off] [height=18pt,width=15em,align=middle,frame=off] [height=18pt,width=20em,align=right,style=\tfx,frame=on] \definefield[textA] [line] [lineABC] [] [] \definefield[textB] [line] [lineABC] [] [] \definefield[textC] [line] [lineABC] [] [] \starttext Calculate the addition: A + B = C\par \field[textA][Please enter A]\par \field[textB][Please enter B]\par \goto{Calculate the Result}[JS(Calculate)]\par \field[textC][The Calculation Result C = ]\par \stoptext ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------