This topic is locked

Button to redirect to edit page using value in record

6/24/2023 5:56:33 PM
PHPRunner General questions
A
asawyer13 authorDevClub member

I have a view invoice page. I have a button on that page that should open the Customer Edit page in a popup.
I need to get the customer id from the invoice record and use it to open the correct customer.
What's the best way to accomplish this?
Alan

Sergey Kornilov admin 6/26/2023

If this is a VIew page you can use getCurrentRecord() API function to read the content of the current record and craft a link that points to that record's Edit page:
https://xlinesoft.com/phprunner/docs/button_getcurrentrecord.htm

A
asawyer13 authorDevClub member 6/30/2023

Okay, I was able to get the key of the record I want to edit and can open the edit page....
However i want to open in a new browser tab in some cases..
and in some cases will want to open the page in a popup..
So in the Client After I have
location.href='customer_edit.php?editid1='+result["CustomerID"];
and that works, but I tried adding target=_blank but must have the syntax wrong and I have no idea how to open it in a popup
Any help would be appreciated.
Alan

A
asawyer13 authorDevClub member 7/1/2023

I changed to this:
window.open('customer_edit.php?editid1='+result["CustomerID"]);
and I was able to open in the new browser tab.
Is there a way to do a popup instead?
Thanks
Alan

A
asawyer13 authorDevClub member 7/1/2023

Got it.
I used:
var popup = Runner.displayPopup( {
url: "customer_edit.php?editid1="+result["CustomerID"],
width: 700,
height: 500,
header: 'Edit customer'
});
in the Client After