This topic is locked
[SOLVED]

 Button in row mastertable for add record in detailtable

10/15/2019 10:25:50 AM
PHPRunner General questions
C
cardman3000 author

Hi together,
i have 2 simple tables stock (master) and stock_bookings (detail) connected over part_id.

In the list view of master is a custom button in each row.

With the click on the button I already get a popup with add page of detail table.

How can I get the part_id from master and transfer it into add page of detail table? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=26832&image=1&table=forumtopics' class='bbc_emoticon' alt=':huh:' />


Best regards

cardman

N
Nir Frumer 10/15/2019
C
cardman3000 author 10/16/2019

Thank you nir,
partially.
This is what I have:
Client Before:
window.popup = Runner.displayPopup({

url: Runner.pages.getUrl("stock_movement","add"),

width: 700,

height: 700,

header: 'New Booking'

});
Server:
$record = $button->getCurrentRecord();

$result["part_no"] = $record["part_no"];
Client After:
empty
What I need is to pass value part_no into new add popup.

Sergey Kornilov admin 10/16/2019
  1. Move your ClientBefore code to ClientAfter code.
  2. Save the value of "part_no" in the session variable.

$record = $button->getCurrentRecord();

$_SESSION["part_no"] = $record["part_no"];


3. Use $_SESSION["part_no"] as a default value of one of details table fields.

C
cardman3000 author 10/16/2019

That's it!
Thank you Sergey <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=89171&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' />