Don't have any code handy, but it's quite straightforward:
- create a hidden frame
- on the select's onchange() do a submit on a form in the hidden frame to
an action that gets the information from the database, passing in the
relevant parameter
- have the action forward to a jsp which is just a javascript call to
update the other select box - probably easiest just to delete the select
box options, iterate through the through the collection returned and for
each one create a javascript call on the other frame that adds an option
for it
let me know if you have any qu's.
cheers,
David
|---------+---------------------------->
| | Erik Weber |
| | <[EMAIL PROTECTED]|
| | ring.com> |
| | |
| | 09/02/2004 01:14 |
| | PM |
| | Please respond to|
| | "Struts Users |
| | Mailing List" |
| | |
|---------+---------------------------->
>------------------------------------------------------------------------------------------------------------------------|
|
|
| To: Struts Users Mailing List <[EMAIL PROTECTED]>
|
| cc:
|
| Subject: Re: dynamically change the dropdown list from a database...
|
>------------------------------------------------------------------------------------------------------------------------|
Do you have an example of this?
Thanks,
Erik
[EMAIL PROTECTED] wrote:
>Or you could get fancy and use a hidden frame which pulls the information
>from the database (via an Action of course!) in 1) - thus avoiding the
>annoying reload.
>
>
>
>|---------+---------------------------->
>| | Yves Sy |
>| | <[EMAIL PROTECTED]|
>| | m> |
>| | |
>| | 09/02/2004 12:32 |
>| | PM |
>| | Please respond to|
>| | "Struts Users |
>| | Mailing List" |
>| | |
>|---------+---------------------------->
>
>------------------------------------------------------------------------------------------------------------------------|
> |
|
> | To: Struts Users Mailing List <[EMAIL PROTECTED]>
|
> | cc:
|
> | Subject: Re: dynamically change the dropdown list from a
database... |
>
>------------------------------------------------------------------------------------------------------------------------|
>
>
>
>
>There are 2 ways to go about this:
>
>1) use an onchange() handler in your select-A that submits the new
>value and retrieves the corresponding values for select-B everytime
>there's a change;
>
>2) pre-load all possibilities and use javascript to change the values
>of select-B that depends on A. This option is practical only for small
>amounts of combinations of data.
>
>I've personally used option 2 before. Check out:
>http://www.mattkruse.com/javascript/dynamicoptionlist/source.html
>
>-Regards-
>Yves
>
>On Thu, 2 Sep 2004 12:21:06 -0400, Shilpa Nalgonda
><[EMAIL PROTECTED]> wrote:
>
>
>>I am having problem dynamically display the dropdown list from database.
>>
>>There are two dropdown list boxes A and B,
>>when the user changes options in dropdown A, the dropdown B should also
>>change dynamically from databse.
>>
>>Both A and B use html select tag.
>>
>>Dropdown A and B are inside the shipReprt.jsp.
>>
>>I am trying to submit to the same jsp on change event of dropdown A ..
>>It does not work, can anyone plesae suggest. I am not struts
>>
>>
>though...below
>
>
>>is the code for Dropdown A..
>>I have to pass the vendor parameter to dropdown B so that i can query
>>database with this parameter...
>>
>><select name="vendor" onchange="document.form2.submit();">">
>> <option value="MERC01" selected>MP BookMaker</option>
>> <option value="ADOBE01">ADOBE</option>
>> </select> </td>
>>
>> <form name="form2" method="post" action="shipReprt.jsp">
>> <% String partner = request.getParameter("vendor");
>> out.println("Size : " + partner);
>> %>
>> </form>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>>
>>
>
>
>--
>For me to poop on!
>http://www.formetopoopon.com
>http://www.nbc.com/nbc/Late_Night_with_Conan_O'Brien/video/triumph.shtml
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]