HTML Dynamic Number of Dropdowns

Posted by Evilsithgirl on Stack Overflow See other posts from Stack Overflow or by Evilsithgirl
Published on 2012-10-04T15:33:47Z Indexed on 2012/10/04 15:37 UTC
Read the original article Hit count: 169

Filed under:
|
|

I have this form on which I would like to create a dynamic number of dropdowns. I have a list of categorized applications which I would like each to have its own dropdown that submits data for each dropdown. The dropdown options will be the same for each. Here is my code. I am not sure how to pass the unique data to the server. As you can see I currently have an iteration over a list of applications that I would like to make each select in that iteration its own dropdown. Thanks in advance.

<html:form action="/CategorizeApps.do">
<h3>Uncategorized</h3>
                    <br/>
                    Categorize each application using the dropdown menu then click categorize.<br/>
                    <table class="list">
                        <thead>
                            <tr class="controls">
                                <td><input type="submit" name="btnAction" value="Categorize"/></td>
                            </tr>
                            <tr class="fields">
                                <td>ID</td>
                                <td>Name</td>
                                <td></td>
                            </tr>
                        </thead>
                        <tbody>
                            <logic:iterate id="uncat" name="appsUncat" scope="session">
                                <tr class="hlist">
                                    <td><bean:write property="id" name="uncat" scope="page"/></td>
                                    <td><bean:write property="name" name="uncat" scope="page"/></td>
                                    <td><select id="category" name="category">
                                            <logic:iterate id="categories" name="Categories" scope="session">
                                                <option value="<bean:write name="categories" property="id" scope="page"/>"><bean:write name="categories" property="name" scope="page"/></option>
                                            </logic:iterate>
                                        </select></td>
                                </tr>
                            </logic:iterate>
                        </tbody>
                    </table>

                </html:form>

© Stack Overflow or respective owner

Related posts about java

Related posts about html