dynamically change the dropdown list from a database...

2004-09-02 Thread Shilpa Nalgonda
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 selectedMP BookMaker/option
option value=ADOBE01ADOBE/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]



RE: dynamically change the dropdown list from a database...

2004-09-02 Thread Jim Barrows


 -Original Message-
 From: Shilpa Nalgonda [mailto:[EMAIL PROTECTED]
 Sent: Thursday, September 02, 2004 9:21 AM
 To: Struts Users Mailing List
 Subject: dynamically change the dropdown list from a database...
 
 
 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...

It's not a struts issue really... you need to write some javascript.  Probably the 
onlick event on the select to submit the form.


 
 
 select name=vendor onchange=document.form2.submit();
 option value=MERC01 selectedMP BookMaker/option
 option value=ADOBE01ADOBE/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]
 
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: dynamically change the dropdown list from a database...

2004-09-02 Thread Yves Sy
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 selectedMP BookMaker/option
 option value=ADOBE01ADOBE/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]



Re: dynamically change the dropdown list from a database...

2004-09-02 Thread dhay

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 selectedMP BookMaker/option
 option value=ADOBE01ADOBE/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]



Re: dynamically change the dropdown list from a database...

2004-09-02 Thread Erik Weber
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 selectedMP BookMaker/option
   option value=ADOBE01ADOBE/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]


Re: dynamically change the dropdown list from a database...

2004-09-02 Thread dhay

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 selectedMP BookMaker/option
option value=ADOBE01ADOBE/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

Re: dynamically change the dropdown list from a database...

2004-09-02 Thread Erik Weber
I was thinking the benefit would be a quicker, smoother refresh since 
only one small piece of the page would be reloaded. Is that not correct? 
I don't know that much about frames.

Erik

Bill Siggelkow wrote:
What is the benefit of the hidden frame? I guess that you can submit 
an entire form ... however, most of the time I only need to drop an ID 
as a request parameter.  I dynamically populate select lists like this:

Use an onchange or onclick JavaScript listener to call a JavaScript 
function that submits the form to a Struts Action. In the Action, 
perform the necessary business logic to construct a new collection for 
the select options, then forward control back to the original JSP 
page. Example 3-11 shows a JSP page that submits the form to an Action 
when the user clicks a radio button. The value of the radio button is 
passed to the Action as a request parameter.

Example 3-11. Submitting a form using JavaScript
%@ page contentType=text/html;charset=UTF-8 language=java %
%@ taglib uri=/WEB-INF/struts-bean.tld prefix=bean %
%@ taglib uri=/WEB-INF/struts-html.tld prefix=html %
html
head
  titleStruts  JavaScript Example/title
  script language=JavaScript
 function getOptions(control) {
form = control.form;
form.action = SetOptions.do?someProp=;
form.action += control.value;
form.submit();
 }
   /script
/head
body
  html:form action=ProcessMyForm
  html:radio property=someProp1 value=val1
   onclick=getOptions(this);/ Value 1br/
  html:radio property=language value=val2
   onclick=getOptions(this);/ Value 2br/
  SomeProp2:
  html:select property=someProp2
 html:optionsCollection property=prop2Values/
  /html:select
  /p
  html:submit/
  /html:form
/body
/html
Bill Siggelkow
[EMAIL PROTECTED] wrote:
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

-
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]


Asunto: dynamically change the dropdown list from a database...

2004-09-02 Thread Guillermo Meyer
Have you tried Providers (http://providers.sourceforge.net/) ?

Providers has a taglib called ComboSelect that allow you to create dependant
drop down lists using javascript and without the need of reloading the page.
Besides, ProvidersTag works in conjunction with ComboSelectTag to create
this combo dependency from database (a little out from MVC, but sometimes
this can be helpfull):

This could be an example:
JSP:

prv:comboselect
 prv:select property=vendor
   prv:options provider=vendors/
 /prv:select
 prv:select property=partner
   prv:options provider=partners/
 /prv:select
/prv:comboselect

And in providers definitions:
provider name=vendors 
className=ar.com.koalas.providers.JDBCProvider
set-property property=jndi value=jdbc/sql/
set-property property=initialContext 
value=java:comp/env/ 
set-property property=keyName value=idvendor/
set-property property=description value=vendorName/
param
param-namequery/param-name
param-valueselect idvendor, vendorName from 
vendors/param-value
/param
/provider

provider name=partners 
className=ar.com.koalas.providers.JDBCProvider
set-property property=jndi value=jdbc/sql/
set-property property=initialContext 
value=java:comp/env/ 
set-property property=keyName value=idpartner/
set-property property=description value=partnerName/
param
param-namequery/param-name
param-valueselect idpartner, idvendor, partnerName from 
partners/param-value
/param
/provider

HTH.
Cheers.
Guillermo.

-- Mensaje original --
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
From:  Shilpa Nalgonda [EMAIL PROTECTED]
To:Struts Users Mailing List [EMAIL PROTECTED]
Subject: dynamically change the dropdown list from a database...
Date:  Thu, 2 Sep 2004 12:21:06 -0400


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 selectedMP BookMaker/option
option value=ADOBE01ADOBE/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]




FiberTel, el nombre de la banda ancha http://www.fibertel.com.ar



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: dynamically change the dropdown list from a database...

2004-09-02 Thread dhay

 only one small piece of the page would be reloaded.
partly I guess.

The clarify, that part of the page is not being "reload" as such - it is
being recreated dynamically (via hidden reload and javascript rebuilding
the select box) to give a better user experience.

cheers,

David



|-+
| |   Erik Weber   |
| |   [EMAIL PROTECTED]|
| |   ring.com|
| ||
| |   09/02/2004 02:19 |
| |   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...
|
  
|




I was thinking the benefit would be a quicker, smoother refresh since
only one small piece of the page would be reloaded. Is that not correct?
I don't know that much about frames.

Erik



Bill Siggelkow wrote:

 What is the benefit of the hidden frame? I guess that you can submit
 an entire form ... however, most of the time I only need to drop an ID
 as a request parameter.  I dynamically populate select lists like this:

 Use an onchange or onclick JavaScript listener to call a JavaScript
 function that submits the form to a Struts Action. In the Action,
 perform the necessary business logic to construct a new collection for
 the select options, then forward control back to the original JSP
 page. Example 3-11 shows a JSP page that submits the form to an Action
 when the user clicks a radio button. The value of the radio button is
 passed to the Action as a request parameter.

 Example 3-11. Submitting a form using JavaScript
 %@ page contentType="text/html;charset=UTF-8" language="java" %
 %@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %
 %@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %
 html
 head
   titleStruts ? JavaScript Example/title
   script language="JavaScript"
  function getOptions(control) {
 form = control.form;
 form.action = "SetOptions.do?someProp=";
 form.action += control.value;
 form.submit();
  }
/script
 /head
 body
   html:form action="ProcessMyForm"
   html:radio property="someProp1" value="val1"
onclick="getOptions(this);"/ Value 1br/
   html:radio property="language" value="val2"
onclick="getOptions(this);"/ Value 2br/
   SomeProp2:
   html:select property="someProp2"
  html:optionsCollection property="prop2Values"/
   /html:select
   /p
   html:submit/
   /html:form
 /body
 /html

 Bill Siggelkow

 [EMAIL PROTECTED] wrote:

 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



 -
 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]