4 Replies Latest reply: Nov 6, 2014 2:31 PM by sonniu RSS

    math in checkbox field

    sonniu Community Member

      I have a question. I have four check boxes , lets say A,B,C,D such that only one could be checked at a time.

       

      I have javascript for each checkbox such that when a box is checked, some fields are disabled and when the same box is unchecked, the disabled fields are enabled again. For example, if box A is checked, then fields 1..10 are disabled and user can write only in fields 11…20. When A is unchecked, all 20 fields are writable.

       

      What I would like to do is if box B (or C/D) is checked (which will imply box A getting automatically unchecked), then the fields disabled by box A are enabled again without having to uncheck box A itself. How can I achieve that? Any advice/tips?

       

      The checkboxes have the same field name but different export value to make them mutually exclusive. Checkbox field name is Service and the 4 export values are service1, service2, service3, service4.

       

      I am using the code below in the first checkbox (shortened version)

       

      var Field1 = getField("AUTH NO_REMOVED");

      var service =getField("Service");

       

      if (event.target.value == "service1")      // I tried using service variable directly, but it only disables the fields upon checking but does not enable them

      {

       

      Field1.readonly = true;

      Field1.fillColor = ["G", 0.75];

      Field1.textColor = ["G", 0.5];}

      else {

      Field1.value = "";

      Field1.readonly = false;

      Field1.fillColor = color.white;

      Field1.textColor = color.black;

      Field1.borderColor = color.transparent;

                     

      }