You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by yamilka vallejo ramos <ya...@gmail.com> on 2006/09/19 00:59:04 UTC

Two drop downs, and I need that the contents of the second dependent on the value selected in the first!!!

Hii everyone,
 I  have  two drop downs in my jsp page, and I need to the contents of the
second dependent on the value selected in the first.
To handle this, I need for the first combo box to do a submit when it
changes, so that I have a chance to update the second. But I don't know in
which part of the Action I most write the code to make update the second
drop down, because I'm working with LooKup Dispach Action , and the Hash Map
wait a parameter that I don't have because I did't make submit to any
button, and there's where I set who it's that parameter

example: for me did't work:

<html:select property="orgId" onchange='document.forms[0].submit()'>
    <html:options collection="orgList" property="value"
labelProperty="longName"/>
</html:select>

because I don't know in which part of the Action I most write the code to
make update the second drop down, because the ActionClass say that it's
waiting a parameter!!

please if somebody know how to do that I will presure!!
thanks!!

Re: Two drop downs, and I need that the contents of the second dependent on the value selected in the first!!!

Posted by Juanjo Cuadrado <jj...@gmail.com>.
Hi,

   I don't know if I have you understands, but I think that this mail of
Eric Givler responds to your question....

You'd need to rebuild the second list on the posting of the form, i.e.
1. get value selected from first list
2. invoke method to refresh dependent list based on user prm from fist list
3. place that list into a request attribute to read on the page.

Here's a code snippet.  The prepareLOVs is called on a post-back event:

public void prepareLOVs(ActionForm form,
                       HttpServletRequest request)
     throws Exception
{
  MyForm myform = (MyForm) form;
  String strCountyId = myform.getCounty_id();
  AppModule am = new AppModuleImpl( request.getRemoteUser() );
  List municipalities = am.getPaMunicipalitiesView( strCountyId );
  request.setAttribute ( Constants.MUNICIPALITIES_LOV , municipalities );



2006/9/19, yamilka vallejo ramos <ya...@gmail.com>:
>
> Hii everyone,
> I  have  two drop downs in my jsp page, and I need to the contents of the
> second dependent on the value selected in the first.
> To handle this, I need for the first combo box to do a submit when it
> changes, so that I have a chance to update the second. But I don't know in
> which part of the Action I most write the code to make update the second
> drop down, because I'm working with LooKup Dispach Action , and the Hash
> Map
> wait a parameter that I don't have because I did't make submit to any
> button, and there's where I set who it's that parameter
>
> example: for me did't work:
>
> <html:select property="orgId" onchange='document.forms[0].submit()'>
>    <html:options collection="orgList" property="value"
> labelProperty="longName"/>
> </html:select>
>
> because I don't know in which part of the Action I most write the code to
> make update the second drop down, because the ActionClass say that it's
> waiting a parameter!!
>
> please if somebody know how to do that I will presure!!
> thanks!!
>
>

RE: Two drop downs, and I need that the contents of the second dependent on the value selected in the first!!!

Posted by "Asthana, Rahul" <Ra...@CIBC.com>.
Could you set a hidden parameter before submitting-
 <html:select property="orgId" onchange='document.forms[0].operation='setDependentList'; document.forms[0].submit()'>
     <html:options collection="orgList" property="value"
 labelProperty="longName"/>
 </html:select>
And write code in the function setDependentList() of the LookupDispatchAction
Here i am assuming document.forms[0].operation is the name of the property the DispatchAction expects.

-----Original Message-----
From: Domingo A. Rodriguez S. [mailto:domingorodriguez@yahoo.com]
Sent: Tuesday, September 19, 2006 8:53 AM
To: Struts Users Mailing List
Subject: Re: Two drop downs, and I need that the contents of the second
dependent on the value selected in the first!!!



javascript remoting or ajax should do fine there. google for it.

 --- yamilka vallejo ramos <ya...@gmail.com> escribió:

> Hii everyone,
>  I  have  two drop downs in my jsp page, and I need to the contents of
> the
> second dependent on the value selected in the first.
> To handle this, I need for the first combo box to do a submit when it
> changes, so that I have a chance to update the second. But I don't know
> in
> which part of the Action I most write the code to make update the second
> drop down, because I'm working with LooKup Dispach Action , and the Hash
> Map
> wait a parameter that I don't have because I did't make submit to any
> button, and there's where I set who it's that parameter
> 
> example: for me did't work:
> 
> <html:select property="orgId" onchange='document.forms[0].submit()'>
>     <html:options collection="orgList" property="value"
> labelProperty="longName"/>
> </html:select>
> 
> because I don't know in which part of the Action I most write the code
> to
> make update the second drop down, because the ActionClass say that it's
> waiting a parameter!!
> 
> please if somebody know how to do that I will presure!!
> thanks!!
> 


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: Two drop downs, and I need that the contents of the second dependent on the value selected in the first!!!

Posted by "Domingo A. Rodriguez S." <do...@yahoo.com>.
javascript remoting or ajax should do fine there. google for it.

 --- yamilka vallejo ramos <ya...@gmail.com> escribió:

> Hii everyone,
>  I  have  two drop downs in my jsp page, and I need to the contents of
> the
> second dependent on the value selected in the first.
> To handle this, I need for the first combo box to do a submit when it
> changes, so that I have a chance to update the second. But I don't know
> in
> which part of the Action I most write the code to make update the second
> drop down, because I'm working with LooKup Dispach Action , and the Hash
> Map
> wait a parameter that I don't have because I did't make submit to any
> button, and there's where I set who it's that parameter
> 
> example: for me did't work:
> 
> <html:select property="orgId" onchange='document.forms[0].submit()'>
>     <html:options collection="orgList" property="value"
> labelProperty="longName"/>
> </html:select>
> 
> because I don't know in which part of the Action I most write the code
> to
> make update the second drop down, because the ActionClass say that it's
> waiting a parameter!!
> 
> please if somebody know how to do that I will presure!!
> thanks!!
> 


__________________________________________________
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis! 
Regístrate ya - http://correo.espanol.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org