RE: [Zope] Changing REQUEST in a javascript
[ Dag Nygren]
Another method is to have Zope put all of the potential choices in the second select box into the Javascript code that gets sent to the client. You could use an associative array to do this. Then populate the second select box with the items in that key of the Javascript associative array. This method works good only when the total number of items is relatively small in both selects and doesn't change very often.
This is probably not a good idea in my case as I in the final page will have 5 SELECTS with 4-10 alternatives that are dependant on each other. The total number of permutations is too high.
Do not be too quick to discard the option. You can probably write a Zope page or script that would generate the alternatives automatically, and the number of Javascript objects would be low enough so that performance would be very good. You should read up on how to create arbitrary Javascript objects using function(), because it lets you do some very neat things quite easily. I have created several pages where the page contains data, and javascript populates several select lists after the page has loaded. One thing to know if you plan to change the contents of a select list after the page has loaded. Netscape 4xx browsers cannot change the page layout once the page has loaded. Therefore you have to make sure that your select boxes are wide enough when the page first loads. One way to do that is to give them a dummy option, such as <option>------------------------------------- You can replace that option when you reload them later. Later browsers (e.g., IE5+ and Mozilla) can resize the select boxes and you do not have to do this hack. Cheers, Tom P
participants (1)
-
Passin,Thomas B. (Tom)