1 Reply Latest reply on Oct 7, 2014 5:04 AM by bruce00j

    Change field from read only and override calculation based on radio button

    bruce00j Level 1

      Hi,

       

      I have a form in which one of the fields has a simple sum calculation and is set to read only so the user can't change it as it sets a print amount as well.

       

      But if one of the radio buttons is ticked there is a chance that the print amount needs changing but it can be different based on a few other options so I have managed to set the field so the user can edit it depending on an option but the calculation that sets the value overrides what the user enters. I would like to know if it is possible to change this?

       

      I use

      this.getField("Quantity_Boxes").readonly = false;
      

      So the user can edit the field when they select the radio button 'yes' under Mesh_b

      and

      this.getField("Quantity_Boxes").readonly = true;
      

      So the field goes back to read only when the user selects the 'no' under Mesh_b

       

      and in the Quantity_Boxes field I use:

      Quantity_Curtains / csn
      

      Just as a simplified division sum with the decimal places set to 0 so a whole number appears.

       

      csn is just a hidden field that has an amount set depending on the size of curtain.

       

      Thanks,

      Bruce

        • 1. Re: Change field from read only and override calculation based on radio button
          bruce00j Level 1

          I have found a solution but caused another problem (well more of an irritation than a problem)

           

          I have made it so the can field throws a dialogue box asking how many of the item fit into a box, the only problem is that the dialogue box will appear more then once.

           

          For example I have made a new size know as bespoke and when I select that size and hit return the dialogue box pops up which is fine but when the amount of the product is changed it throws the dialogue box again. I guess this is because the calculation has to be run again but is there anyway of stopping this?

           

          Here is the code I use in the can field which defines how many curtains are in the box and is used to calculate how many labels need printing out.

           

          if(this.getField("SizeDrop").value=='LG'){
          event.value = "5"
          } else if (this.getField("SizeDrop").value=='ST'){
          event.value = "8"
          } else if (this.getField("SizeDrop").value=='ME'){
          event.value = "10"
          } else if (this.getField("SizeDrop").value=='SM'){
          event.value = "15"
          } else if (this.getField("SizeDrop").value=='BE'){
          var resp = +app.response("Enter the amount of curtains in a box","","1");
          event.value = resp
          } else {
          event.value = " "
          }
          
          

           

           

          Thanks,

          Bruce

           

          EDIT:

          I have found that the dialogue box will appear every time something is changed on the form (even while in the editor as well)