Hi,
I need help here, I copied the code from https://xlinesoft.com/blog/2021/05/26/database-based-dropdowns-with-dialog-api/?fbclid=IwAR3U_LeloCHU3KxhgF7C0Q7cwKtygHgI7ue_q797Bst2qjNnUmTLYZ3sPck, however it doesnt do anything, this is my code, I will appreciate if someone can help me.:
//Before Display $lookup = array(); $rs1 = DB::Query("SELECT Email,Full_Name FROM Applicants ORDER BY
First Name` ASC");
while( $data1 = db_fetch_array($rs1))
{
$row = array();
$row[] = $data1["Full_Name"];
$row[] = $data1["Email"];
}
$pageObject->setProxyValue("lookup", $lookup);
///////////////////////////////////////////////////////////////////// For another table//////////
$rs = DB::Query("SELECT RId, nick_name FROM Restaurants ORDER BY nick_name ASC");
$restaurants = [];
while($data = $rs->fetchAssoc())
{
$restaurants[] = [$data['RId'], $data['nick_name'] ];
}
$pageObject->setProxyValue('restaurants',$restaurants);
///////////////////// End Before Display////////////////
//Client Before
window.proxy = proxy;
return ctrl.Dialog
(
{
title: 'Preferences',
fields: [
{
name: 'email',
label: 'Select emails',
type: 'lookup',
required: true,
//attribute:'multiple',
options: window.proxy['lookup']
}
],
ok: 'Save',
cancel: 'Cancel',
beforeOK: function( popup, controls ) {
swal('Success', 'Selected emails: ' + controls[0].val(), 'success');
}
}
);
// Server
$result["email"] = $params["email"];
// Client After
// Put your code here.
var message = result['email'];
swal (message);`