jtzako
Založený: 12.01.2017
Príspevky: 16
Zaslal: 2017-01-13 18:37
Návrat hore
Odpovedať s citátom
|
I'm trying to create a custom button that will open a new URL (php file) with some information passed to it.
I can make it create the custom button this way and it will open the new URL:
$opts['buttons']['L']['up'] = array('<<','<','add','change','copy','>','>>','goto','goto_combo',array(
'name' => 'Email' , 'value' => 'Email', 'code' => '<a href="requestemail.php class="button" target="_BLANK">Email</a>')
);
However, I need to pass to that URL the value of one of my fields for the selected record.
I tried the code below but it isnt working. It stops at the <?php $key; ?> and doesnt populate that, and the class/target and text dont get done either.
$opts['buttons']['L']['up'] = array('<<','<','add','change','copy','>','>>','goto','goto_combo',array(
'name' => 'Email' , 'value' => 'Email', 'code' => '<a href="requestemail.php?PME_sys_rec="<?php $key; ?>" class="button" target="_BLANK">Email</a>')
);
What I need is for when I click that button it gets the currently selected record info to pass to the new php file.
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2017-01-13 22:13
Návrat hore
Odpovedať s citátom
|
Search in the forum for CONCAT which you can use to create the URL, optionally as a new dummy field in VLF modes or else within the field of the unique identifier.
// Pass the field named `primary_domain_name` in a link to another form such that
// the passed `primary_domain_name` is used as a filter in the other form's List mode.
$opts['fdd']['dummy2'] = array (
'name' => 'Edit',
'sql|VLF' => 'if(primary_domain_name <> "",
CONCAT("<a href=\"data.php?s=22&PME_sys_fl=1&PME_sys_fm=0&PME_sys_sfn[0]=1&PME_sys_qf1=", primary_domain_name, "\" target=\"_blank\">Edit</a>"),
"")',
'options' => 'VLF',
'input' => 'R',
'escape' => false,
'sort' => false
);
|
jtzako
Založený: 12.01.2017
Príspevky: 16
Zaslal: 2017-01-13 23:41
Návrat hore
Odpovedať s citátom
|
I've looked extensively at the forum including the CONCAT entries but it does not look like CONCAT can be used with a custom button.
I would only want this button on List mode, it would need to get the value of the record via the selector bullet point similar to how "Change" or "Copy" do currently.
I would want the button to either show up to the left of each row like the graphic buttons do, or up in the row of buttons along with the Add, Change etc.
|
doug
Založený: 10.02.2003
Príspevky: 1013
Bydlisko: Denver, Colorado (USA)
Zaslal: 2017-01-14 02:12
Návrat hore
Odpovedať s citátom
|
You'll need a virtual (dummy) field to pass the View link, client_id is the unique identifier in this example. You can make this the first column but it would take a week to determine how to make it appear directly next to the icons for the four functions View, Change, coPy, Delete.
$opts['fdd']['dummy1'] = array (
'sql|VLF' => 'if(client_id <> "",
CONCAT("<a href=\"contacts.php?PME_sys_fl=1&PME_sys_fm=10&PME_sys_sfn[0]=1&sn=2&PME_sys_operation=PME_op_View&PME_sys_rec=",
client_id, \" target=\"_blank\">Client</a>"), "")',
'options' => 'VLF',
'input' => 'R',
'escape' => false,
'sort' => false
);
|
jtzako
Založený: 12.01.2017
Príspevky: 16
Zaslal: 2017-01-17 16:50
Návrat hore
Odpovedať s citátom
|
Edit: Found an extra \ that caused the SQL error.
Edit2: Found the problem with undefined index also.
Thanks for the info, this should work nicely.
|
|
Odoslať novú tému
Odpovedať na tému
|
|