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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T07:54:41+00:00 2026-06-02T07:54:41+00:00

I am trying to validate a Select field in using HTML5; it’s working perfectly

  • 0

I am trying to validate a Select field in using HTML5; it’s working perfectly fine in Chrome and FF browser, but when I tried in IE and Safari, it’s not working. I tried using a JavaScript to get it to work, but I’m still having the same problem. Please help me out. The sample of my code is here:

  • http://i1159.photobucket.com/albums/p637/Apulo_Cosmas/validate.jpg

How can I fix it so the same code works with all four browsers?

  • 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-02T07:54:43+00:00Added an answer on June 2, 2026 at 7:54 am

    Instead of an onclick on the submit button, it’s better to have this:

    <script type="text/javascript">
    function validate(f) {
        if (f.empty.value == '') { alert('you must enter text'); return false; }
        if (f.select_box.value == '') { alert('you must select something'); return false; }
    }
    </script>
    
    <form name="form1" action="test2" onsubmit="return validate(this)">
    ...
    <input type="submit" value="Go!" />
    </form>
    

    Edit: The validate(this) will call the validate function and pass itself (the form) as f. Then, the fields within the form can be refered to by name (e.g. empty and select_box)

    Hope this helps 🙂

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

Sidebar

Related Questions

I am trying to validate html select element using jQuery Validate plugin. I set
I'm trying to validate the following XML but I'm unable to, can you please
I’m trying to validate input by using egrep and regex.Here is the line from
I'm trying to validate a input field with the JQuery validation plugin. The numeric
I'm trying to position the jquery validate message under the select box and text
I'm trying to remote validate a field by looking at two different fields. The
I'm trying to work out how to validate a user in my application but
I'm trying to validate a SELECT. Normally I'd use an inList, as SELECT implies
I'm using the jQuery Validation plugin and trying to validate two time fields. I
I'm using rails 3.1.0.rc5 while trying to implement a pseudo enum field. I am

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.