I have a dumb new guy question.
I have a global field (gpatient_name_for_lookup) that displays a valuelist of patient names. The field is assigned a value of ‘Select Patient’. Onfocusgained, I run a method to clear the field.
On data change I run the following script to lookup the patient.
controller.find()
lastname_firstname_city = globals.gpatient_name_for_lookup
var x = controller.search()
if(x == 0)
{
var btn = globals.Error_message(‘You did not select a Patient from the List’, ‘Try Again’);
if (btn == ‘Try Again’)
{
controller.loadAllRecords()
}
}
globals.gpatient_name_for_lookup = ‘Select Patient’
The method works perfectly when you select a name by typing and hitting the enter key, but does not work properly when you select a name from the list with the mouse.
With a mouse click, the method takes you to the right patient, but the global field quickly displays “Select Patient” then quickly drops the value list and then goes blank.
My best guess is that setting the global field to ‘Select Patient’ is causing the onfocusgained script to fire but I’m not sure how to fix it.
Any help would be appreciated. Thanks.
Carmen