Select records from a list page using checkbox

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
kaldiris
User
Posts: 58

Select records from a list page using checkbox

Post by kaldiris »

Hi ! I am new here.
But i try.

Have a example for this case ?
I like make page similar to delete.

After filter list, checked some lines, and click button.
This button send de ID´s chekeds to new php page and select regs. Just List.

How to receive a list/array of IDs checked ? and send to a another php page ?

Sorry my bad english ok.


mobhar
User
Posts: 11703

Post by mobhar »

You may use "Page_Load" and "Row_CustomAction" server events that belong to the List Page. To get the selected record IDs, you may use getFilterFromRecordKeys(), for example:

function Page_Load() {
//echo "Page Load";
$this->CustomActions["star"] = "Add Star"; // Where "star" is the id and "Add Star" is the caption of the custom action
}

// Row Custom Action event
function Row_CustomAction($action, $row) {
// Return FALSE to abort
if ($action == "star") { // Check action name
echo "<br>" . $this->getFilterFromRecordKeys();
}
return TRUE;
}

Please read "Server Events and Client Scripts" topic from PHPMaker Help menu for more info and example.


kaldiris
User
Posts: 58

Post by kaldiris »

Hi.
I need send the actual filter expression to custom page/file.

Just similar this exemple:
// Page Load event
function Page_Load() {
//echo "Page Load";

$item = &$this->ExportOptions->add("PSel");
$item->Body = "<a href='z_processar.php?filtro=$filter' target='_blank'>Processar</a>";
  • NOT WORK

}

I like build a list selected lines in custom list... after confirm some fields, start a process.

How to obtain a Expression Filter in ListPage for send to custom page.php ?

Thanks for any answer.

Sorry my Bad English.


kaldiris
User
Posts: 58

Post by kaldiris »

I use your tip. (add star) Thanks a Lot.
But a like to list selected records before my custom process. Same like Delete.

I need send selected records / ( or Filter Expression ) to MyFile.php
Then select again... list... make some questions and config process field...
Confirm and process.

I new in PhpMaker 2019.

Thanks a lot.


mobhar
User
Posts: 11703

Post by mobhar »

You may use a session variable to store the value from $this->getFilterFromRecordKeys();

Then simply use that session variable in your MyFile.php Custom File.


kaldiris
User
Posts: 58

Post by kaldiris »

Thanks again...

I make this:

function Recordset_Selecting(&$filter) {
// Enter your code here
$_SESSION['myvar'] = $filter;
}

and in my custom page:

$filtro=str_replace("EV__","",$_SESSION['myvar']);
    $sql = "SELECT `dimcarga`.`id` as `ID`, `dimcarga`.`Projeto` as `PROJETO`,`dimcarga`.`comodo` as `COMODO` FROM `dimcarga`  where ". $filtro ;
echo $db->ExecuteHtml($sql, ["fieldcaption" => TRUE,... ]]); // Execute a SQL and show as HTML table

But I now... is not a "beatiful" metodo.

Work for me and my problem...
Thanks a Lot...


Post Reply