This topic is locked
[SOLVED]

Dropdown with custom buttom

3/23/2022 8:09:35 AM
PHPRunner General questions
I
Ivan van Oosterhout author

Hi,

I am trying to get a dropdown with a custom button.

I saw some tricks to get the dropdown running but it is not working. Do i forget something?
I have the feeling that $params["component"]; is not fillid in the Server event.

I receive the dropdown, i can select a value from the database, SWAL present me the correct value which i have selected.
I need to transport the value $data["artikelnr"] to the server event with $params["component"] and this is not working.

In my edit screen i have build this.

Before display:
$lookup = array();

$rs = DB::Query("SELECT id, groep, artikelnr, artikelbeschrijving, Modules, systempic FROM Installatieautomaat");

while( $data = $rs->fetchAssoc() )

{

$row = array();
$row[] = $data["artikelnr"];
$row[] = $data["artikelbeschrijving"];

$lookup[] = $row;
}

$pageObject->setProxyValue("lookup", $lookup);

Client Before:

return Runner.Dialog( {
title: 'Preferences',
fields: [{
name: 'component',
type: 'lookup',
value: 0,
options: proxy['lookup']
}],
ok: 'Save',
cancel: 'Cancel',
beforeOK: function( popup, controls ) {
swal('Success', 'Selected component: ' + controls[0].val(), 'success');
}
}
);

Server:

$data = $button->getCurrentRecord();

$NewData = array();
$NewData["comp_12"] = $params["component"];
DB::Update("Meterkasten_units", $NewData, "id = ".$data["id"]."");

Client After:
window.location.reload();

I
Ivan van Oosterhout author 3/23/2022

PS:
I know that controls[0].val() contains the correct value.