Not exactly sure what answer you are looking for but this may help...

Javascript error checking:

        //Standard Form Validation
        if (thisForm.<%=NameofclassHere.AttributeNameHere%>.selectedIndex <
1)
        {
        alert('Please select a NameHere.')
        thisForm.<%=NameofclassHere.AttributeNameHere%>.focus()
        return false;
        }

        if (thisForm.<%=NameofclassHere.AttributeNameHere%>.selectedIndex <
1 
          || thisForm.<%=NameofclassHere.AttributeNameHere%>.value == ''
          || thisForm.<%=NameofClassHere.AttributeNameHere%>.value == '0')
        {
        alert('Please select a NameHere.')
        changeJobs(form1, 'SecondComboTitleHere');
        return false;
        }

JSP:
//Create instance of your bean
NameOfYourBean instanceOfBean = new NameOfYourBean();

        <tr>
            <td>
                <!--****BEGIN DRAW FIRST COMBO BOX****-->
                <%
                        String yourVar1 = getParameter(session,
NameofClassHere.AttributeNameHere);
              %>
              <%= instanceOfBean.nameOfMethod(yourVar1)  %>

               
                <!--****END DRAW FIRST COMBO BOX****-->
            </td>
            <td colspan="2" width="60%">// NOTE I PUT THE WIDTH HERE SO THE
REST OF MY FORM DID NOT JUMP BASED UPON SELECTION VALUE
            <!--****BEGIN DRAW SECOND COMBO BOX****-->
                <%
                      String yourVar2 = getParameter(session,
NameofClassHere.AttributeNameHere);
                %>
                <%= instanceOfBean.nameOfMethod(yourVar2) %>
                <!--****END DRAW SECOND COMBO BOX****-->
            </td>
        </tr>


If your page is web based and needs to work in Netscape, for proper
presentation you will need to add a few <option>&nbsp;</option> in your bean
if you want more than one choice to be visible in the drop down. Also note
that in Netscape the combo box size does not resize according to the
contents. Another guide to go by is http://www.carpoint.com. Hope this
helps.... 

lettybug

-----Original Message-----
From: Alex Colic [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, April 10, 2001 12:14 PM
To: Struts
Subject: How to fill combo two depending on choice in combo one?


Hi,

I have two combo boxes on my page. Depending on the choice in combo 1
determines what is populated in combo two.

I have a tag that creates combo boxes populated via a function parameter. I
can populate the first combo with this tag and then when the user selects an
item in the combo box I can get the value via JavaScript but then what do I
do?

Any help is appreciated.

Regards

Alex Colic

Reply via email to