[thelist] javascript: matching values in arrays

Garth Hagerman hagerman at mcn.org
Fri Nov 30 20:42:56 CST 2007

Hi all-
This will probaly be real easy for someone with good Javascript  
skills; mine are shaky at best. This is part of a medical records  
database system. To make the data entry easier, I'm writing a JS which  
matches a diagnosis code to the name of the diagnosis. Currently, the  
clerk has to type "277.3" in one field, and then "Amyloidosis" in the  
next, for example. With this script, she'll enter the code, 277.3 in  
this example, and the Amyloidosis magically appears in the next field.  
I've got a semi-functional version of the script here:
I've left all of the server-side stuff off this test page; all we're  
concerned about here is the JS.
As long as the string entered into the diagnosis code field is in the  
relevant array, the name of the condition pops up just fine. When the  
code field has a string which isn't in the array, it's supposed to add  
"no match" to the name field. Instead, the script gets stuck in a loop  
or something, I get a slow script warning from the browser and the no  
match text never appears.
I've been bashing my head against a wall for long enough, and I have  
no idea what to query Google for an answer.
What am I doing wrong?

                            * * * * * * * * * * * * * * * *
                                my online portfolio


More information about the thelist mailing list