PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 03/14/2017 10:56 AM by  agersh
Hide/Unhide buttons added to a Detail lines object
 4 Replies
Sort:
You are not authorized to post a reply.
Author Messages
agersh
Systems Analyst
Martin Health System
Veteran Member
(143 points)
Veteran Member
Posts:73


Send Message:

--
03/14/2017 9:41 AM

    On the MA64.1 form I added a button to the Detail lines object. When the form is first displayed the added button is displayed on every Detail line row. I want to hide the button on each row until the FORM_OnAfterTransaction function is called where I then only want to unhide the button if the row has data.  

     

    Anyone have an idea how to accomplish this?

    David Williams
    Private
    Private
    Veteran Member
    (3076 points)
    Veteran Member
    Posts:1036


    Send Message:

    --
    03/14/2017 9:52 AM
    I would set the button.value="" after the form initialize and then on after transaction. In the on after, I would then get the form value of a field in the line and if a value exists, set the button.value="Click me"
    David Williams
    Randy Jacoy
    Application Developer
    U.S. Bank
    Veteran Member
    (132 points)
    Veteran Member
    Posts:46


    Send Message:

    --
    03/14/2017 10:03 AM

    If you are using Lawson 10 you may need to do something like this:

    for(var i = 0; i < 12; i++) {  // Change this to the number of lines you have.
      my_button = lawForm.getFormElement("push1",i); // Get a reference to the image button 
      my_button.style.visibility = 'hidden';  // Hide the button.
    }
     
    Then to show the button use my_button.style.visibility = 'visible';  // Show the button.

     

    John Henley
    Private
    Private
    Senior Member
    (9650 points)
    Senior Member
    Posts:3234


    Send Message:

    --
    03/14/2017 10:04 AM
    in the scripte, use the .style.visibility property to hide/show...

    in FORM_Oninit(), add code to hide the button.

    // change cursor to hand & make invisible the custom change button
    var objChangeBtn = lawForm.getFormElement("imgchange");
    if (objChangeBtn) {
    objChangeBtn.style.cursor="hand";
    objChangeBtn.style.visibility="hidden";
    }

    In FORM_OnAfterTransaction()

    var objChangeBtn = lawForm.getFormElement("imgchange");
    if (objChangeBtn) {
    objChangeBtn.style.visibility="visible";
    }
    Thanks for using the LawsonGuru.com forums!
    John
    agersh
    Systems Analyst
    Martin Health System
    Veteran Member
    (143 points)
    Veteran Member
    Posts:73


    Send Message:

    --
    03/14/2017 10:56 AM
    THANK You everyone for your help. We are using Lawson 10 so all of your replies were helpful .
    You are not authorized to post a reply.