This topic is locked

Using checkbox on list page for another purpose

6/9/2015 4:18:07 PM
PHPRunner General questions
D
dodgebros author

I have attached a screen capture of the area on the master list page I will be asking about.
In this project I am breaking down the data in an existing spreadsheet into sections. For each section I have created a table. I have created a master-detail relationship between the master table and the other tables.
As it is now, if a user clicks on any of the tables listed in the menu, except the master table, they just see a list of all of the records in that table. I want the user to have to click on the Master link in the menu and then check the checkbox of a record in the resulting list of the master table. Next when the user clicks on one of the other links in the menu the records will be filtered down to just the records at go with the single record checked on the master table list page. I also need a way to determine if the user has checked more than one record on the master table list page and abort the opening of another table until this is corrected.
I hope this makes sense.

TD
screen capture is here: http://www.2amsoftware.com/phpr2/index.html

Sergey Kornilov admin 6/9/2015

There is no image and it doesn't make much sense without it.

D
dodgebros author 6/9/2015



There is no image and it doesn't make much sense without it.


Fixed the image problem, it should be live now:
screen capture is here: http://www.2amsoftware.com/phpr2/index.html

D
dodgebros author 6/11/2015

Here is what I need to accomplish:

  1. Whenever the user clicks on any of the buttons in the menu, except the one named "Master", I need to first get a count of the records that have the check-box checked. If the count is not 1 then the event tied to that button gets aborted and an alert() pops up telling the user to select a single record. So, here is what I have so far:
    Code that determines if single record selected or not:
    var cnt = $("input[name='selection[]']:checked").length;
    if ((cnt == 0) || (cnt > 1)) {

    alert('Please Select A SINGLE Record First');

    return false;

    }

    Since this is Javascript code I am not sure where to place it in regards to events. Also, where would you access the click event for a particular button on the menu?
  2. If the user only selected a single record then the event under the button is fired and the associated page appears and shows ONLY records linked to that master record.
    I need to get the value of the pid field of the selected master record so I can pass it here to the $strWhereClause parameter.
    D1->List page->List Page:Before SQL Query event: $strWhereClause = "fpid = x"; "x" is the value of the pid field of the selected master record
    I hope this makes more since and now that the screen capture is working you can see what I want to accomplish.
    Thanks,

    TD

D
dodgebros author 6/12/2015

OK, maybe if I ask it this way it will help you guys understand what I am trying to do:
In the screen capture below, the parent table on the menu is named Master and all of the other tables on the menu are child tables. What I would like for the user to do is check the check box for one record on the Master List page, then when the user clicks on one of the child tables they only see the child records for that parent record.
How can I accomplish this?
Your help would greatly appreciated!

TD
screen capture is here: http://www.2amsoftware.com/phpr2/index.html