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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T00:43:32+00:00 2026-05-24T00:43:32+00:00

I have the following form: <select name=size> <option value=>Please Select</option> <option value=1>Medium</option> <option value=2>Large</option>

  • 0

I have the following form:

<select name="size">
    <option value="">Please Select</option>
    <option value="1">Medium</option>
    <option value="2">Large</option>
</select>
<select name="material">
    <option value="">Please Select</option>
    <option value="9">Wood</option>
    <option value="8">Metal</option>
</select>   
<input type="submit" value="submit">

I would like some help creating some javascript, when the above form is submitted the form is verified that values have been selected, and successfully gets submitted. If values have not been selected an alert popups saying either of the following:

  1. “Size needs to be selected and material needs to be selected”,
  2. “Size needs to be selected”,
    or
  3. “Material needs to be selected”

Thanks

  • 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-24T00:43:33+00:00Added an answer on May 24, 2026 at 12:43 am
    $("form").submit(function(){
        if ($("#size").val() == "" && $("#material").val() == "") { alert("Size and material  needs to be selected"); return false; }
        elseif ($("#size").val() == "") { alert("Size needs to be selected"); return false; }
        elseif ($("#material").val() == "") { alert("Material needs to be selected"); return false;}
        $(this).submit();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have following filteringselect: <select name=v dojoType=dijit.form.FilteringSelect valueList=v id=v value=0><option value=></option><option value=0>0-test</option><option value=1>1-test2/option><option value=2>2-test3</option><option
I have the following HTML <select onchange=this.form.submit() name=name> <option value=9995101E01#17201044055PM>9995101E01#17201044055PM</option> <option value=GRR-Example>GRR-Example</option> <option value=admin>admin</option>
I have a select list like the following inside of a form. <select name=0[voicemail]
I have the following markup: <select multiple=multiple id=targetFilesList style=width:200px;height:110px;> </select> <input type=button value=Get id=btnGet
I have the following select field in a form: { xtype: 'selectfield', name: 'minprice',
I have the following multi-select box in a HTML form, where user can select
I have the following form <form name=myForm id=myForm method=post enctype=multipart/form-data action=script.php> and this jQuery
i have the following form item { fieldLabel:'Username' ,id:username ,name:'username' ,allowBlank:false ,plugins:[Ext.ux.plugins.RemoteValidator] ,rvOptions: {
I have an input box like the following: <input type=text value= somethingSpecial=filename.txt id=myID class=box>
I have the following html form... <html> <head><title>Upload Servlet</title></head> <body><h2>Upload Servlet</h2> <form name='uploadparams' enctype='multipart/form-data'

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.