Page 1 of 2

How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 1:52 pm
by Dave Troxel

I am trying to get a button in my panel to trigger the click function of a button I have on the adjoining page. Can't seem to figure out the event to make that happen. Can anyone help please?


How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 2:27 pm
by Evgene Karachevtsev

Hello Dave,

You can use this code:

codeAppery("mobilebutton_17").trigger("click");/code

where "mobilebutton_17" is the name of button on which you want trigger event.


How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 3:00 pm
by Dave Troxel

Hi Evgene. The button is now firing the delete, but it is removing the first item on the list instead of the one I have open.

In the two screencaptures I show my mouse over the 'faux' Delete button on list item 'Test14'. When I click it, it opens the panel. From the panel you see I have now selected the 'Yes, Delete' button. I have attached two events to this one. One to run the code you gave me above, and one to close the panel. Unfortunately, when I do so, it doesn't delete Test14 as I wanted, it will delete Test12 from the top of my list. I have a taskID field hidden in each. How can I associate the code you gave me to the correct list item? Thanks again.. making progress! Image Image


How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 3:02 pm
by Dave Troxel

Evgene, please see my next Reply. Still need some direction. Thanks!


How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 3:41 pm
by Evgene Karachevtsev

Hello,

When you click "delete" button you should add this JS:

codelocalStorage.setItem("btnName", $(this).attr("name"));/code

When you click "Yes, delete" you should add this JS:

code$("[name="+localStorage.getItem("btnName") +"]").trigger("click");/code


How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 4:10 pm
by Dave Troxel

Just to clarify.. in each of these two codes, it appears I need to modify "btnName" to the name of the actual delete button on the page, and "name" to the name of the ID field? Also in the second code for 'Yes, delete' button, I see "[name=" do I modify that with "[ID=" or .. ? Just a bit lost here. Thanks again Evgene.


How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 4:21 pm
by Dave Troxel

Also.. do I still need to use this JS:
Appery("mobilebutton_17").trigger("click");
on the 'Yes, Delete' button?


How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 4:26 pm
by Evgene Karachevtsev

Each element has unique attribute "name". Try using these snippets of code as they are.


How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 4:54 pm
by Dave Troxel

Ok, as you suggested, but now it is deleting every item in the list. Completely wipes the entire list.


How to get button in panel to trigger hidden button on page?

Posted: Thu May 15, 2014 5:08 pm
by Dave Troxel

There are a total of 3 delete buttons but only one of them has the actual delete events built in it.
1st Button) If you look at my first illustration you will see there is a round button (red) with an X. It is the actual delete button and when fired deletes the line item it resides within correctly. (This one will be hidden once testing is concluded)
2nd Button) the large red bar button labeled Delete which only opens the panel, nothing more.
3rd Button) is in the panel itself labeled 'Yes, Delete' to throw the trigger on the actual delete button (1st Button) of the line item that is open at the time.
I hope this helps. Thanks again Evgene.