Universally Related Popup Menus AJAX Edition: Part 1
3: Modify Your HTML Page:
Add the following code to the HEAD of your document:
This code tells Internet Explorer to save the dynamically generated list options and selections between pages.
Convert the "reset" button, if applicable, to a simple "button" type and add the following code to the onClick() event. This is done so that the form resets before the lists:
OPTIONAL STEP: Parameters are passed to the URPM_AJAX.js script via hidden fields. This saves you from having to muck around in the script. In fact, unless you want to do something special, you shouldn't have to modify the getListItems.asp or URPM_AJAX.js scripts at all! There are five parameters that can be set. The first is the showBlank field. It tells the script to include a blank item at the top of the list which would be used in the case of non-mandatory fields. It will accept any non-whitespace and non-zero value as true. Hence, "True", "true", "False", "dog", "whatever" would all evaluate to true. Conversely, a value of "0" or "false" would be interpreted as false. Moreover, the absence of a value or the hidden field itself will also default to false.
The next hidden field is promptText. If you'd rather have some text instead of a blank field, you can set the prompt text such as "Please Make a Selection" or "Levels" here. If you include a value in this field, showBlank is redundant and therefore not required.
The defaultIndex field sets the listIndex on the base list when the page first loads. It is zero-based and doesn't include the optional blank entry. The following HTML code will select the eleventh item as the default value if showBlank is false and the twelfth if it is true:
The final two fields relate to the location of your server-side script. The url field can be used to supply your own script instead of getListItems.asp.
The FileDSN field is used to provide your own file DSN for the database. The default path, stored in the getListItems.asp file is "c:\inetpub\URPMs dB\URPMs.dsn". If you want to store the DSN in a different folder, or wish to rename it, you'll have to use this field.
And that's it. You're good to go.
About the Author
Original: January 23, 2008