Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4080322
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:54:55+00:00 2026-05-20T17:54:55+00:00

I have a form where a user selects a file, and then should be

  • 0

I have a form where a user selects a file, and then should be able to choose how many parameters the report they are uploading has

I want to have a drop down that has the numbers 0 -5 and when a user selects a number that many boxes with parameter types are shown, like a drops down with “date”, “name”, “part#” etc… in a select menu, is made for each number the user selects

I looked through the other solutions on S.O. and they make sense but I just can’t seem to get them to work,

here is what I have so far just to test if one box will appear:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
  xmlns:ui="http://java.sun.com/jsf/facelets"
  xmlns:f="http://java.sun.com/jsf/core"
  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:c="http://java.sun.com/jsp/jstl/core">


<h:head>

</h:head>

<body>



    <ui:composition template="./templates/template.xhtml">

        <ui:define name="content">
            <c:choose>
                <c:when test="#{controls.designAuth}">
                Welcome Report Designer!<br /><br />

                <div id="fileUpload">



                    <form name="myForm" action="../UploadServlet" enctype="multipart/form-data" onsubmit="return validate_form(this);" method="POST">

                        <b>Make sure your filename is meaningful (eg. WasteByMachineReport.jrxml)</b><br /><br />

                        Please specify a file:<input type="file" name="file" size="40"/><br />
                        Number of parameters: <select name='numSelect' onchange="draw_param_dropdowns();">
                                                    <option>0</option>
                                                    <option>1</option>
                                                    <option>2</option>
                                                    <option>3</option>
                                                    <option>4</option>
                                              </select><br />

                                              <select class="parametersHide"  id="select1"><option></option></select>
        <script type="text/javascript" language="Javascript">


                                                    function draw_param_dropdowns(){

                                                      var sel = document.getElementById("select1");
                                                      sel.style = "visibility:visible";
                                                    }

           </script>

                        <input type="submit" value="Upload"/>

                    </form>

                </div>
                </c:when>
                <c:otherwise>
                    Not Authorized 
                </c:otherwise>
            </c:choose>

        </ui:define>

    </ui:composition>

</body>
</html>

“view Source” result:

<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link href="./../resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
    <link href="./../resources/dtree/dtree.css" rel="stylesheet" type="text/css" />


    <script type="text/javascript" src="./../resources/dtree/dtree.js"></script>
    <title>Reports</title></head><body>


    <div id="top" class="top">

            <h1>Wingfoot Reports v0.3
                <div style="float:right;margin-right: 20px;">
<form id="j_idt8" name="j_idt8" method="post" action="/WebApplication8/faces/designer.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt8" value="j_idt8" />
<span style=" font-size: 20px; font-weight: normal;">SCOTT </span><input type="submit" name="j_idt8:j_idt10" value="Logout" style=" font-size: 20px;" /><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-4683216470766096399:-9055922898460672452" autocomplete="off" />
</form>
                </div>
            </h1>
    </div>
    <div>
        <div id="left">

<form id="j_idt14" name="j_idt14" method="post" action="/WebApplication8/faces/designer.xhtml" enctype="application/x-www-form-urlencoded">
<input type="hidden" name="j_idt14" value="j_idt14" />

                        <center>
<script type="text/javascript" src="/WebApplication8/faces/javax.faces.resource/jsf.js?ln=javax.faces&amp;stage=Development"></script>
<a href="#" onclick="mojarra.jsfcljs(document.getElementById('j_idt14'),{'j_idt14:j_idt16':'j_idt14:j_idt16'},'');return false">Design</a> | <a href="#" onclick="mojarra.jsfcljs(document.getElementById('j_idt14'),{'j_idt14:j_idt18':'j_idt14:j_idt18'},'');return false">Admin</a> | <a href="#" onclick="mojarra.jsfcljs(document.getElementById('j_idt14'),{'j_idt14:j_idt20':'j_idt14:j_idt20'},'');return false">Queries</a><br />
                        <hr />

                        </center><input type="hidden" name="javax.faces.ViewState" id="javax.faces.ViewState" value="-4683216470766096399:-9055922898460672452" autocomplete="off" />
</form>
        </div>
        <div id="content" class="left_content">
                Welcome Report Designer!<br /><br />

                <div id="fileUpload">



                    <form name="myForm" action="../UploadServlet" enctype="multipart/form-data" onsubmit="return validate_form(this);" method="POST">

                        <b>Make sure your filename is meaningful (eg. WasteByMachineReport.jrxml)</b><br /><br />

                        Please specify a file:<input type="file" name="file" size="40" /><br />
                        Number of parameters: <select name="numSelect" onchange="draw_param_dropdowns();">
                                                    <option>0</option>
                                                    <option>1</option>
                                                    <option>2</option>

                                                    <option>3</option>
                                                    <option>4</option>
                                              </select><br />

                                              <select class="parametersHide" id="select1"><option></option></select>
<script type="text/javascript" language="Javascript">


                                                        function draw_param_dropdowns(){

                                                      var sel = document.getElementById("select1");
                                                      sel.style = "visibility:visible";
                                                    }

    </script>

                        <input type="submit" value="Upload" />

                    </form>

                </div>
        </div>
    </div>
</body>

</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T17:54:56+00:00Added an answer on May 20, 2026 at 5:54 pm

    You could try to do it in a sort of a loop with a modification to your style tag, since it looks like you want the user to input something, I’ll use input tags.
    So for instance you have:

    <select name="numSelect" id = "numSelect" onchange="draw_param_dropdowns();">
                                                    <option>0</option>
                                                    <option>1</option>
                                                    <option>2</option>
                                                    <option>3</option>
                                                    <option>4</option>
                                              </select>
    <!-- Create all the boxes for input and hide them initially -->
    <select name="select1" id="select1" style="display:none;"><option></option></select>
    <select name="select2" id="select2" style="display:none;"><option></option></select>
    ...
    

    And for your javascript:

    <script type="text/javascript" >
    //Loop through the drop down boxes and hide them all.
    //This will ensure that you don't have 'leftover' boxes after selecting
    function draw_param_dropdowns() {
            for (var x = 1; x <= 4; x++) {
                document.getElementById('select' + x).style.display='none';
            }
    
            for (var y = 1; y <= document.getElementById("numSelect").selectedIndex; y++) {
                document.getElementById('select' + y).style.display = 'block';
            }
        }
    </script>
    

    It may be a bit longer than what some of the other coders at SO can do, but hopefully this leads to more understanding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form a user can enter their name, then it will add
I have a form in which the user can choose a component type from
I have a form on a page where the user has inputs to edit
On a website if I have a form where the user can input some
I have a form which takes both the user details and an image uploaded
We have a form that allows a user to filter a list with by
I have to display a column chart in a user form in VBA. Exporting
I have a form with a Clear button. When the user clicks Clear, I
I have a search form and result list. The form allows the user to
In my current application I have a form that requires the user to enter

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.