PEOPLES, MICHAEL P (ATTSI | 22 Feb 2011 14:21
Picon
Favicon

[webmin-devel] UI Control to Provide Dynamic List On Change In Drop Down

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.

Thanks.

Michael Peoples
Senior Systems Manager
(Continue reading)

Jamie Cameron | 22 Feb 2011 22:19

Re: [webmin-devel] UI Control to Provide Dynamic List On Change In DropDown

On 22/Feb/2011 05:21 PEOPLES, MICHAEL P (ATTSI) <mp4783 <at> att.com> 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
(Continue reading)


Gmane