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

  • SEARCH
  • Home
  • 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 8904625
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:10:52+00:00 2026-06-15T02:10:52+00:00

I’m new in web developing, I tried to look for any resources from internet

  • 0

I’m new in web developing, I tried to look for any resources from internet but I still can’t figure out my problem…

=> reads text file and generates options…
my test.jsp page

<tr>
<td>Select test : </td>
<td><select id="testname" name="testname" onchange="makeBox()">
while ((src = test.readLine()) != null){
    param = "";
    temp =src.split(":");
    tempsize =temp.length;
    if ((tempsize >2)){
        int i;
        for (i=2; tempsize>i ; i++){
            if((temp[i].equals("null"))){
                 param = "";
            }
            else if ((i ==2) && (temp[i] != "null")){
                 param = temp[i];
            }
            else if ((i > 2)){
                 param = param + "," + temp[i];
            }
         }
     }
      %>
     <option value="<%=param%>" name="<%=temp[0]%>"><%=temp[0]%></option>
     <%
}
test.close();
    %>
</select></td>
</tr>

When user selects one of these options, javascript will generate corresponding parameters in inputtext box…(number of parameters varies by each test)

Ex. Let’s say

<option value="size,height,weight" name=apple>apple</option>

is selected. Then I want my page to show 3 text boxes like….

<td> Enter size: </td>
<td><input type="text" id="size" name="size"></td>
<td> Enter height: </td>
<td><input type="text" id="height" name="height"></td>
<td> Enter wieght: </td>
<td><input type="text" id="weight" name="weight"></td>

My attempt:

<script type="text/javascript">
    function makeBox() {
        var selected = document.getElementById('batchname');
        for (var i=1, n=selected.options.length;i<n;i++){
            if (selected.options[i].value){
                var a = "<input type = 'text' name = '" + selected.options[i].value + "' id = '" + selected.options[i].value + "'>";
                document.getElementById("inputBox").innerHTML = a;
            }
        }
    };
    </script>

text file that I’m reading from:

Apple:A.B.C.D:size:colour
Banana:G.C.D.E:length
Pear:L.D.E.F:shape:weight:color
Orange:E.C.A.W:density:length:color:weight
Melon:E.P.D.A                    // no param

^ doesn’t do anything…
Am I fundamentally wrong to send multiple values from select box to create multiple input box?
If there is better way, please suggest to me…:)
thanks for your help!

  • 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-06-15T02:10:53+00:00Added an answer on June 15, 2026 at 2:10 am

    You have to add an event listener to your select field and create an element when the value is chaged. Here’s a little code that might help you. I am only writing a rough code to give you an idea. You have to work around with it to make it work on your particular case.

    you have to set this event listener as soon as the body is loaded. So on your HTML

    <body onload="init()" id="stage" class="theme">
    

    and on your javascript

    function init() {
       document.getElementById("selectListID").addEventListener("change", function(){
          var value = document.getElementById("selectListID").value; // this gives you the selected value.
          // Your code to add the element that you need.
       };)
    }
    

    Hope this helps.
    Hope this helps.

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

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.