Options in Drop down box

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm using IE to create a form that includes a drop down box and a submit
button .

The drop down box contains a number of options, but one of the options is no
longer available.

If the unavailable option is chosen and the submit button is pressed, how do
I get a pop up box to appear telling the user the option is no longer

Hope this makes sense


Re: Options in Drop down box

Paul BRYAN said:

Quoted text here. Click to load it

the only reliable way to do it would be to either remove the option
server side so its not there to be selected or check if an option is no
longer valid when the form is submitted and return an error message. you
could use a bit of JS to pop up an alert but you'll still need to do the
server side checking.

02/December/2003 07:35:50 pm kilo

Re: Options in Drop down box

Paul BRYAN wrote in message ...
Quoted text here. Click to load it

Surely the most "User-Friendly" action is to remove the option itself. LOL.


Re: Options in Drop down box

Like others say, best is to remove the option, but if you insist, here is
some javascript that will alert the yser (but not prevent).

<script type="text/javascript" language="JavaScript">
function CheckAvail(theForm)
 var mytext = theForm.selection.value;
 if (mytext == 's002') {
  alert('potatoes have been sold out');
<title>limit chars</title>
<form method="post" action="yoururl" id="myForm">
 <select name="selection" onChange="CheckAvail(myForm);">
 <option value="s001">flowers
 <option value="s002">potatoes
 <option value="s003">cheese
 <option value="s004">beans

News Updater, No scripts, No Database

Re: Options in Drop down box

Louis Somers wrote:
Quoted text here. Click to load it

Another possibility is

<form ... onSubmit="return myFunc();">

where, if myFunc returns  false , the submission is
cancelled - _*IF*_ the user has enabled JavaScript!

Olaf from THE Hamburg (not home of hamburgers)
Replace laundry basket by my last name to avoid ending up in such.

Site Timeline