Using the "Links to other pages," I can format the link to work so it appends the ID dynamically from the detail view I am clicking the button on, but I can't figure out how to make that be popup instead of a new page. I use the "Buttons executing javascript functions." If I hard code the value, it works to open up a popup, but I can't seem to reformat it to include the dynamic ID.
Here is my code the Links example is "Add a Credit Card," and the button example is "Add a Credit Card2"
AppGini Version 24.11
AppGiniHelper.min.js?v=1711874380:13 AppGiniHelper Javascript Library Version 2023.01.04.2
Code: Select all
// file: hooks/Bidders-dv.js
// get an instance of AppGiniDetailView class
var dv = AppGiniHelper. DV;
// hide the id-field
dv.getField("ID").hide();
dv.setTitle('Bidder Details');
var BidderID = AppGiniHelper.DV.getField('ID');
var BidderID_value = BidderID.getValue();
// create a (full sized) row (width = 12) and
// add a headline "Bidder Info" ("#Bidder Info"), then
// add fields "last_name", "first_name", then
// add a divider-line ("-"), then
// add fields "birth_date" and "age".
// beautify label-alignment (sizeLabels(2))
var row_1 = new AppGiniLayout([1,1,10])
.add(1, ["#Bidder Info"])
.add(2, ["ID"])
.sizeLabels(2);
var row_2 = new AppGiniLayout([7, 5])
.add(1, ["ContactID"])
.add(2, ["BidNo"])
.sizeLabels(2);
var row_3 = new AppGiniLayout([12])
.add(1, ["-"]);
var row_4 = new AppGiniLayout([7, 5])
.add(1, ["#Pre-Event", "BidderType", "TablePreference"])
.add(2, ["#Event", "Card", "CheckedIn", "QuickPay", "TotalBids","TotalOwed","TotalPaid"]);
// create a variable "container" for easier handling of new action buttons
var container = dv. ActionButtons();
// create a group named "Links"
var group = container.addGroup("Links");
// add some links
group.addLink("Print Invoice", "bidder_invoice.php?BidderID=" + BidderID_value, Variation. Warning, "print");
group.addLink("Add Credit Card", "creditcard.php?BidderID=" + BidderID_value, Variation.Success, "credit-card");
// add two buttons for toggling the compact-mode with no text but icons "minus"/"plus"
group.addButton("Hide", function () { dv.compact(); }, null, "minus");
group.addButton("Show", function () { dv.compact(false); }, null, "plus");
group.addButton("Add Credit Card2", function openPopup() {
// Replace 'https://www.example.com' with the desired URL
window.open('creditcard.php?BidderID=1', '_blank', 'width=1000,height=600');
});