Hello Everyone,
I am trying to retrieve the corresponding employeeid from another table which relates to a card_id. I have had previous success with field events and so I am trying to use them, but every turn I take seems to slam another door shut. Now I can't even get the field event to trigger.
Firstly, I am inputting the card id using an RFID card scanner. It retrieves the card id and adds '\r\n' (CR LF) at the end of the number. It has previously worked without intervention.
On the field called card_id I have attached the following field event:
Client Before:
var ctrlcarduid = Runner.getControl(pageid,'card_uid');
params["carduid_in"] = ctrlcarduid.getValue();
This should retrieve the value of the card I have scanned in the RF card reader from the card_id field..
Server:
$result["employee_id"] = DBLookup("SELECT employee_id FROM card_uid_xref WHERE card_uid = '" . $params['carduid_in'] . "'");
This should set the result "employee_id" to the corresponding employee_id.
Client After:
var ctrlempid = Runner.getControl(pageid,'employee_id');
ctrlempid.setValue(result["employee_id"]);
This should set the employee_id field to the retrieved employee_id, which is the end result I am trying to achieve.
I just cannot get this to work. I have even started a new project from scratch, but to no avail. Should this field event work as I have typed it here ?
I am using this on an apache web server, accessing a MySQL database - list, add and edit pages work fine.
Any help is greatly appreciated.
Best regards,
Craig