You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Srinivasula Reddy A , Bangalore" <sr...@hcl.in> on 2007/05/10 10:23:05 UTC

Need Help On Combo Box Population VERY URGENT REQUIREMENT

Hi Struts User Community,

 

I need a rough IDEA / CODE on there are  three combo boxes are there
depending on the first combo box selection second combo box has to
populate and depending on the second combo box selection third one has
to populate.

 

Like populating all the states of country in a combo box when I select a
county in another combo box. Again if I select state in the combo box I
have to populate all the districts in another combo box

 

What are the tags I have to use in my JSP and what is the code I have to
write in my ACTION class.

 

Regards,

Sreenivasula Reddy A

 



DISCLAIMER:
-----------------------------------------------------------------------------------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in 
this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of 
this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have 
received this email in error please delete it and notify the sender immediately. Before opening any mail and 
attachments please check them for viruses and defect.

-----------------------------------------------------------------------------------------------------------------------

RE: Need Help On Combo Box Population VERY URGENT REQUIREMENT

Posted by Kapil Sharma <ka...@iap-online.com>.

BTW it is not related to struts but javascript n client programming query ?


For the sake I am giving u a hint.

It is the way how you are going to set the pattern according to single entry
change.
Take all the required data into the page and set the pattern accordingly.
i.e on change event you have to call a function to populate the pattern.

Get elements

var sel1 = document.getElementById(id1);   // Country
var sel2 = document.getElementById(id2); // State

Set pattern

var pattern1 = /( |^)(select)( |$)/;
var pattern2 = new RegExp("( |^)(" +  sel1.options[sel1.selectedIndex].value
+ ")( |$)");

Match the pattern

var clonedOptions = clone.getElementsByTagName("option");
 for (var i = 0; i < clonedOptions.length; i++) {
         if (clonedOptions[i].className.match(pattern1) ||
              clonedOptions[i].className.match(pattern2)) {
             sel2.appendChild(clonedOptions[i].cloneNode(true));
         }




Thanks and Regards,
Kapil Sharma


-----Original Message-----
From: Srinivasula Reddy A , Bangalore [mailto:srinivasulaa@hcl.in]
Sent: Thursday, May 10, 2007 5:23 PM
To: Struts Users Mailing List
Subject: Need Help On Combo Box Population VERY URGENT REQUIREMENT



Hi Struts User Community,



I need a rough IDEA / CODE on there are  three combo boxes are there
depending on the first combo box selection second combo box has to
populate and depending on the second combo box selection third one has
to populate.



Like populating all the states of country in a combo box when I select a
county in another combo box. Again if I select state in the combo box I
have to populate all the districts in another combo box



What are the tags I have to use in my JSP and what is the code I have to
write in my ACTION class.



Regards,

Sreenivasula Reddy A





DISCLAIMER:
----------------------------------------------------------------------------
-------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and
intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its
affiliates. Any views or opinions presented in
this email are solely those of the author and may not necessarily reflect
the opinions of HCL or its affiliates.
Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of
this message without the prior written consent of the author of this e-mail
is strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. Before opening any mail and
attachments please check them for viruses and defect.

----------------------------------------------------------------------------
-------------------------------------------



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