4 Replies Latest reply on Feb 17, 2010 10:47 AM by gkaiseril

    Validate Script in from field

    Otto Weber

      Hi to all

       

      I've got a form field which calculates the sum of a bunch of other fields which works fine. This sum field is marked as read only for it's only purpose is to show the sum.

       

      But the value of the sum must not exceed 100. If I configure the normal validation in the sum field's properties, the message window will pop up when the user fills values in the other fields and the standard message makes not clear that it is the sum which is too high.

       

      So I wrote a little script.

       

      var f = this.getField("Busin_Typ_Sum");
      if (f.value >100) {app.alert({ cMsg: "Sum of percent should not exceed 100",cTitle: "Watch the sum"});}

       

       

      This nearly works fine, the only problem is that the alert pops up when the sum exceeds 100 a second time.

       

      Example:

       

      User types 90 in the first field

      User types 20 in the second field Nothing happens

      User types 10 in the third field Alert Box appears

       

      The Alarm should go off after filling the second field. Can anybody help?

       

      Thanks a lot,

      Otto