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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T00:30:27+00:00 2026-05-19T00:30:27+00:00

Hey guys, I just updated my signup form to include drop down menu selectors

  • 0

Hey guys, I just updated my signup form to include drop down menu selectors to select gender and class and section. But I don’t know how to verify them and check that a value is selected.
Here is the code:

<form name="registration_form" method="post" action="register.php" onsubmit="return Validate();"><input type=hidden name=todo value=post>
            <table>
            <tr><td class="label">First Name:</td><td><input type="text" name="fname"></td></tr>
            <tr><td class="label">Last Name:</td><td><input type="text" name="lname"></td></tr>
            <tr><td class="label">Gender:</td><td><select name="gender">
                                                            <option>Select your gender:</option>
                                                            <option value="M">Male</option>
                                                            <option value="F">Female</option>
                                                            </select></td></tr>
            <tr><td class="label">E-Mail Address:</td><td><input type="email" name="email"></td></tr>
            <tr><td class="label">Username:</td><td><input type="text" name="username"></td></tr>
            <tr><td class="label">Password:</td><td><input type="password" name="password"></td></tr>
            <tr><td class="label">Password Confirmation:</td><td><input type="password" name="password_confirmation"></td></tr>
            <tr><td class="label">Class:</td><td><select name="class">
                                                            <option>Select your class:</option>
                                                            <option value="1">Grade 1</option>
                                                            <option value="2">Grade 2</option>
                                                            <option value="3">Grade 3</option>
                                                            <option value="4">Grade 4</option>
                                                            <option value="5">Grade 5</option>
                                                            <option value="6">Grade 6</option>
                                                            <option value="7">Grade 7</option>
                                                            <option value="8">Grade 8</option>
                                                            <option value="9">Grade 9</option>
                                                            <option value="10">1S</option>
                                                            <option value="11">2S</option>
                                                            <option value="12">3S</option>
                                                            </select></td></tr>     
            <tr><td class="label">Section:</td><td><select name="section">
                                                            <option>Select a section:</option>
                                                            <option value="A">A</option>
                                                            <option value="B">B</option>
                                                            <option value="C">C</option>
                                                            <option value="D">D</option>
                                                            <option value="S">S</option>
                                                            <option value="SE">SE</option>
                                                            <option value="GS">GS</option>
                                                            <option value="LS">LS</option>
                                                            </select></td></tr>                                                                                     
            <tr><td>Are you human?</td></tr>
            </table>
            <?php
             ini_set('display_errors', 'On');
             error_reporting(E_ALL | E_STRICT);
          require_once('recaptchalib.php');
          $publickey = "6LfF478SAAAAAFR1_ZfSFzGyEhkcXlNVRg8iJeWU"; // you got this from the signup page
          echo recaptcha_get_html($publickey);
                ?>
        <table>
            <tr><td class="label"><input class="submitButton" type="submit" value="Register"></td></tr>
            </table>
            </form>
        </div>
    <script language = "Javascript">

function Validate()
{
    if (document.registration_form.fname.value == '') 
    {
        alert('Please fill in your  first name!');
        return false;
    }
    if (document.registration_form.lname.value == '') 
    {
        alert('Please fill in your last name!');
        return false;
    }
    if (document.registration_form.email.value == '') 
    {
       alert('Please fill in your email address!');
       return false;
    }
    if (document.registration_form.username.value == '') 
    {
        alert('Please fill in your desired username!');
        return false;
    }
    if (document.registration_form.password.value == '') 
    {
       alert('Please fill in your desired password!');
      return false;
    }
    if (document.registration_form.password_confirmation.value == '') 
    {
       alert('Please fill in your password again for confirmation!');
      return false;
    }
    if (document.registration_form.password.value != 
    document.registration_form.password_confirmation.value) 
    {
        alert("The two passwords are not identical! "+
        "Please enter the same password again for confirmation!");
        return false;
    }
    return true;
}
</script>

My question is what can I add to the Validate function so that it returns false if the values selected are “Please select your … “

Edit(1): Ok I tried this but it didn’t seem to work, what’s wrong?

var selectedClass = document.getElementById("class");
        if(selectedClass.selectedIndex ==0){
            alert('Please select your class!');
            return false; 
        }

Edit(2): Never mind I got it to work.

  • 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-19T00:30:27+00:00Added an answer on May 19, 2026 at 12:30 am
    function validate(){
     var selectedClass = doument.getElementById("Class");
     if(selectedClass.selectedIndex ==0){
      alert(selectedClass.options[0].text);
      return false; 
     }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey guys I just noticed that my join statement here SELECT * FROM reports
Hey guys I want a form to be submitted but it just won't work
Hey guys, I'm new to mysqli and I have a question. I just updated
Hey guys, I'm working on a status-Updater. It works, there is just one problem,
Hey guys just a quick question about the performance of drawRect: as I've noticed
Hey guys, I am just trying to pull all the records from my database
Hey guys this should be simple, I'm just not seeing it, I would like
Hey guys this is my html code: <div class=nakupy> <li class=icn_kategorie><a href=#>Nákupy</a> <div class=sub_menu>
Hey guys just a quick question, I am posting mp3s in dialog boxes each
hey guys I just started trying to convert my query structure to PDO and

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.