From: Jamie C. <jca...@we...> - 2011-02-22 21:19:33
|
On 22/Feb/2011 05:21 PEOPLES, MICHAEL P (ATTSI) <mp...@at...> wrote .. > Does anyone know of code or a module where I could examine the code, to > do the following? > > - Create a drop down box populated with a list of items of which one and > only one is selected. I already have this via ui_select subroutine. > - Use the currently selected item in the list above as a "filter" (in > this case it will be part of the WHERE clause of an SQL SELECT > statement) to populate a list > - If user changes the selected value in the drop down box, then the list > is repopulated with new values. > > I know that this will involve the use of JavaScript and I have already > tried to fuse some ui_select code with some ui_multi_select code. I > realize the multi_move function does not do what I'm asking for here, > but the fact that it dynamically redisplays values in the right > (options) list is not too far off what I am trying to do here. > > I've also looked through many modules for this type of function (so I > could see an example), but could find none. > > I'd like to put this into a subroutine that I can call with parameters > that would define both the drop down box and list, essentially a union > of ui_select and a single list version of ui_multi_select. > Rather than spend hours (days) trying to figure this out on my own, I > thought someone might know how to do this. There isn't any function in Webmin currently that can do this exactly ... however, you could implement it reasonably easily using Javascript. The simple approach would be to have your perl code run the SQL query for every item in the first menu, and generate javascript lists of results that get included in the page. These would then be used to populate the list by javascript that gets run when the menu changes. You can see an example of some code like this in dhcpd/edit_host.cgi - Jamie |