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 9085549
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T21:16:18+00:00 2026-06-16T21:16:18+00:00

For a registration form I’m looking for a way to give the user more

  • 0

For a registration form I’m looking for a way to give the user more options based on a number (#) they choose in an formfield.

I’ve searched and found a way to do this with javascript but it does not allow the tag, it does however accept etc. but not a dropdown menu field.

 <fieldset>
    <legend>Step 2/3: Virtual Machine Options</legend>
                    <div>
                        <label for="vmammount">Order # VM's</label>
                        <select name="vmammount" required="required">
                            <option value=""></option>
                            <option value="1">1</option>
                            <option value="2">3</option>
                            <option value="3">3</option>
                            <option value="4">4</option>
                            <option value="5">5</option>
                            <option value="6">6</option>
                            <option value="7">7</option>                        
                            <option value="8">8</option>
                            <option value="9">9</option>
                            <option value="10">10</option>
                        </select>
                    </div>
                    <div>
                        <label for="vmos">VM OS 1</label>
                        <select name="vmos" required="required">
                            <option value=""></option>
                            <option value="1">Windows Server 2008</option>
                            <option value="2">Windows XP</option>
                            <option value="3">Debian</option>
                            <option value="4">CentOS</option>
                        </select>
                    </div>
<div>
                        <label for="vmos">VM OS 2</label>
                        <select name="vmos" required="required">
                            <option value=""></option>
                            <option value="1">Windows Server 2008</option>
                            <option value="2">Windows XP</option>
                            <option value="3">Debian</option>
                            <option value="4">CentOS</option>
                        </select>
                    </div>
                </fieldset>

The OS 1 field is always visible, the other selection field that will follow are dependent on the first field in which the user chooses a value from 1 till 10. Any suggestions?

  • 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-16T21:16:20+00:00Added an answer on June 16, 2026 at 9:16 pm

    The best way is to create all os selection elements in HTML / PHP … but only display them if nessesary. Here an example with jQuery, its also possible with plain javascript but needs at least 10times mutch lines of code.

    http://jsfiddle.net/vuPwM/2/

    <fieldset>
        <legend>Step 2/3: Virtual Machine Options</legend>
            <div>
                <label for="vmammount">Order # VM's</label>
                <select name="vmammount" id="vmammount" required="required">
                    <option value=""></option>
                    <option value="1">1</option>
                    <option value="2">3</option>
                    <option value="3">3</option>
                    <option value="4">4</option>
                </select>
            </div>
            <div id="vmos_block">
                <div class="vmos" id="vmos_block_1">
                    <label for="vmos_1">VM OS 1</label>
                    <select name="vmos[1]" id="vmos_1" required="required">
                        <option value=""></option>
                        <option value="1">Windows Server 2008</option>
                        <option value="2">Windows XP</option>
                        <option value="3">Debian</option>
                        <option value="4">CentOS</option>
                    </select>
                </div>
    
                <div class="vmos" id="vmos_block_2">
                    <label for="vmos_2">VM OS 2</label>
                    <select name="vmos[2]" id="vmos_2" required="required">
                        <option value=""></option>
                        <option value="1">Windows Server 2008</option>
                        <option value="2">Windows XP</option>
                        <option value="3">Debian</option>
                        <option value="4">CentOS</option>
                    </select>
                </div>
    
                <div class="vmos" id="vmos_block_3">
                    <label for="vmos_3">VM OS 3</label>
                    <select name="vmos[3]" id="vmos_3" required="required">
                        <option value=""></option>
                        <option value="1">Windows Server 2008</option>
                        <option value="2">Windows XP</option>
                        <option value="3">Debian</option>
                        <option value="4">CentOS</option>
                    </select>
                </div>
    
                <div class="vmos" id="vmos_block_4">
                    <label for="vmos_4">VM OS 4</label>
                    <select name="vmos[4]" id="vmos_4" required="required">
                        <option value=""></option>
                        <option value="1">Windows Server 2008</option>
                        <option value="2">Windows XP</option>
                        <option value="3">Debian</option>
                        <option value="4">CentOS</option>
                    </select>
                </div>
            </div>
    </fieldset>
    
    <script type='text/javascript'>//<![CDATA[ 
    $(window).load(function(){
        $('.vmos').hide();
    
        $("#vmammount").change(function () {
            $('.vmos').hide();
    
            if ($(this).val() < 1) {
                return false;
            }
    
            for (var i = 1; i <= $(this).val() ; i++) {
                  $('#vmos_block_' + i).show();          
            }
    
            return true;
        });
    });//]]>  
    
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating a registration form using validation inside the User model such as validates_confirmation_of
I have a user registration Form. If a new User register their account in
I have a registration form where this CSS rules apply. when user submits with
I have a registration form that I am using to register new user. No
I have a user registration form. I am doing server side validation on the
I have a user registration form that has a password and confirm password field.
I've a user registration form and I want to show the password rules in
I have a user registration form and I only want the user to specify
I have simple registration form. Once all information entered, user click submit button and
I'm creating a registration form for a client for an event they're hosting. The

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.