PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 01/10/2014 2:58 PM by  Robert Spurr
Inactivate Add Button on Form
 6 Replies
Sort:
You are not authorized to post a reply.
Author Messages
Chris12
Private
Private
Veteran Member
(366 points)
Veteran Member
Posts:150


Send Message:

--
01/06/2014 10:13 AM
    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
    Private
    Private
    Veteran Member
    (344 points)
    Veteran Member
    Posts:130


    Send Message:

    --
    01/06/2014 3:29 PM
    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
    Private
    Private
    Veteran Member
    (366 points)
    Veteran Member
    Posts:150


    Send Message:

    --
    01/07/2014 7:36 AM
    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
    Private
    Private
    Veteran Member
    (344 points)
    Veteran Member
    Posts:130


    Send Message:

    --
    01/07/2014 9:39 AM
    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
    Private
    Private
    Veteran Member
    (366 points)
    Veteran Member
    Posts:150


    Send Message:

    --
    01/07/2014 12:11 PM
    Thanks Robert ... I will give that a try today....
    Chris12
    Private
    Private
    Veteran Member
    (366 points)
    Veteran Member
    Posts:150


    Send Message:

    --
    01/10/2014 10:01 AM
    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
    Private
    Private
    Veteran Member
    (344 points)
    Veteran Member
    Posts:130


    Send Message:

    --
    01/10/2014 2:58 PM
    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.
    You are not authorized to post a reply.