This topic is locked
[SOLVED]

 button with redirect to an add page

8/6/2020 6:55:14 AM
PHPRunner General questions
Tedy author

Hello,

How can I add a button on the list page so that I can redirect the user to a specific addition page?

The code should contain the masterkey.

The link should include something like:

client_add_etic_albe_add.php?masterkey1=1&masterkey2=36788474&masterkey3=2%20PLUS%201%20ADVERTISING%20SRL&masterkey4=END%20USER&masterkey5=0&masterkey6=CURIER&mastertable=clienti

Sergey Kornilov admin 8/6/2020

Here is how to perform the redirect from the button:

https://xlinesoft.com/phprunner/docs/inserting_button.htm#examples

Check example #4
To create a link like this you will have to retrieve master table data in Server part of button's code and pass it to ClientAfter event.

Check this for more info:

https://xlinesoft.com/phprunner/docs/inserting_button.htm#passing_data

Tedy author 8/12/2020

Hello

Here's what I did for it:

  1. The parent-child relationship was created between the master table and an add view for the detail table with 6 relationships:
    • ID-->ID_CLIENT
    • CUI-->CUI_CLIENT
    • DENUMIRE-->DEN_CLIENT
    • TIP_CLIENT-->TIP_CLIENT
    • TERMEN_DE_PLATA-->TERMEN_DE_PLATA
    • MOD_DE_LIVRARE-->MOD_DE_LIVRARE




2. On the List page of the client_produse table I added a custom button.


Client Before

empty
Server



$record = $button->getMasterRecord();

$result["ID"] = $record["ID"];

$result["CUI"] = $record["CUI"];

$result["DEN_CLIENT"] = $record["DENUMIRE"];

$result["TIP_CLIENT"] = $record["TIP_CLIENT"];

$result["TERMEN_PLATA"] = $record["TERMEN_DE_PLATA"];

$result["MOD_DE_LIVRARE"] = $record["MOD_DE_LIVRARE"];


PS. the function used is getMasterRecord() -- https://xlinesoft.com/phprunner/docs/getmasterrecord.htm
Client After



location.href='client_add_articole_add.php?page=add&masterkey1='+result["ID"]+'&masterkey2='+result["CUI"]+'&masterkey3='+result["DEN_CLIENT"]+'&masterkey4='+result["TIP_CLIENT"]+'&masterkey5='+result["TERMEN_PLATA"]+'&masterkey6='+result["MOD_DE_LIVRARE"]+'&mastertable=clienti';


PS. client_add_articole_add.php page for adding views to the client_product table
The result is:


Pressing the button redirects to the page