Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VALIDATE A HTML SELECT

Posted on 2000-04-06
1
Medium Priority
?
210 Views
Last Modified: 2010-04-09
this is my code:

<Font type="verdana" size="2">Urgency:</Font><SELECT size=1 id=txtUrgency_Type name="txtUrgency_Type">
<OPTION selected>Please select</OPTION>
<OPTION value="URG">Urgent</OPTION>
<OPTION value="NON">Non Urgent</OPTION>
</SELECT>

i want to validate this in jscript any ideas?

also how do i pass this value to an asp page
0
Comment
Question by:jonnygrant
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
Deathead earned 60 total points
ID: 2689771
in between the <head></head> tags place the following code

<script language="Javascript">
function ckit()
{
  if(document.forms['FORMNAMEHERE'].elements['SELECTNAMEHERE'].selectedIndex == 0)
  {
   alert("Please choose Urgent or Non urgent")
   return false
  }
  else
  {
    return true
  }
}
</script>

and in your <form> tag place the command onSubmit='return ckit()'
it should look like this
<form Action="WHATEVER" name="FORMNAME" onSubmit="return ckit()">

you will need to add names to the form tag and select tag as javascript does not handle the ID tag good in both browsers
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question