#native_company# #native_desc#

Remote Scripting with Javascript, IFrames and PHP Page 9

By David Vance
on May 10, 2004

As a couple of additional notes, once the user selects a value from the
list, clicks the submit button and the page is reloaded,
the search term and the Select List are de-populated. To
get around this, I added the hidden element “listAsStrng”
to the form, and set its value in handleResponse() here:


var = new getObj('listAsStrng');

l.obj.value str;


Now, when the form is submitted, and the page reloaded, the
search textbox () and the select list ()
can be repopulated with their values, maintaining state for the user.
Also, it’s possible, if you can track down the source code
(remember our principle of copy and paste?), to remove the
text box and implement the Select list as a combination
editable text box and drop down list. It’s a bit hairy and
browser specific, so I’ll leave this as an exercise for the reader.
So, we now have a fairly fluid implementation of
a dynamic drop down using PHP, JavaScript, Remote Scripting,
and a bit of copy and paste. Enjoy.