Inactivate Add Button on Form

Author
Messages
Chris12
Veteran Member
Posts: 150
Veteran Member
    I am trying to figure out the best way to inactivate the "add" button when the form loads if there are any values on a certain text box ..... Any help is greatly appreciated ....

    Thanks,

    Chris
    Robert Spurr
    Veteran Member
    Posts: 130
    Veteran Member
      If you plan on bouncing between active and inactive, the simplest way is to interrogate the action taken against your criteria for allowing the action to be performed. In this case if fc == "A" and ......what ever follows either perform the add or return false. Another option is to remove all the form buttons and replace them with button objects and hidden or make visible as needed although this is probably overkill.
      Chris12
      Veteran Member
      Posts: 150
      Veteran Member
        Robert, thanks for your reply. So essentially what I would like is everytime the form is open, it would be check if there is some value in a text box, if so the Add button would be inactivated .... So then how would I inactivate it .... Chris
        Robert Spurr
        Veteran Member
        Posts: 130
        Veteran Member
          What I was saying is that you don't need to activate or inactivate the button but instead control whether the action should be processed. When they click the button a variable 'fc' will contain the action code in most cases for an Add it is "A". You would then check to see it was an Add along with the other criteria relevant to processing, in your case a text field and decide whether to allow the action to continue.

          As an example
          function FORM_OnBeforeTransaction(fc)
          {
          if (fc == "A" && lawForm.getFormValue("text48") == "Whatever")
          {
          //ends process
          return false;
          }
          return true;
          }
          Chris12
          Veteran Member
          Posts: 150
          Veteran Member
            Thanks Robert ... I will give that a try today....
            Chris12
            Veteran Member
            Posts: 150
            Veteran Member
              Robert, I am making some headway. Thank you very much.

              One last question, if there a way to change the FC of a button?
              For example from A to C ...

              Thanks
              Robert Spurr
              Veteran Member
              Posts: 130
              Veteran Member
                The short answer is yes. You can change the properties directly on the form (Hardcode), assign a different value to FC through your script but be aware if you change it to something not defined and pass it through to process it will fail and finally you could update the properties value through your script, same issue as FC. The last option is the more difficult one and I don't have an example.
                ---