473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

check required in a select

check required in a select
how can i control if a combobox (a select) is not null (index is -1) or if
index is 0 if the first element is for example a null value or simply a
description of the field .

I try to use this

if (combobox.SelectedIndex==0 || combobox.SelectedIndex==-1)
{
alert('obbligatorio');
combobox.focus();
combobox.select();
}
Jul 23 '05 #1
2 3229
On Sat, 09 Oct 2004 10:43:38 GMT, SAN CAZIANO <al**********@tin.it> wrote:

[snip]
if (combobox.SelectedIndex==0 || combobox.SelectedIndex==-1)


Javascript is case-sensitive. The selectedIndex property starts with a
lowercase 's'.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 23 '05 #2
"SAN CAZIANO" <al**********@tin.it> wrote in message
news:uh*******************@news3.tin.it...
check required in a select
how can i control if a combobox (a select) is not null (index is -1) or if
index is 0 if the first element is for example a null value or simply a
description of the field .

I try to use this

if (combobox.SelectedIndex==0 || combobox.SelectedIndex==-1)
{
alert('obbligatorio');
combobox.focus();
combobox.select();
}

Try this; watch for word-wrap.

<html>
<head>
<title>combobox.htm</title>
<script type="text/javascript">
function test() {
var combobox = document.form1.combo;
if (combobox.selectedIndex <= 0) {
alert("obbligatorio");
combobox.focus();
combobox.selectedIndex = 0;
combobox.select;
}
}
</script>
</head>
<body>
<form name="form1">
<select name="combo" size="3">
<option>
<option>1
<option>2
</select>
<input type="button" value="test()" onclick="test()">
</form>
</body>
</html>


Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dmitri Shvetsov | last post by:
Hi, What methods can we use to check the integrity problems? Some records in my database are having Foreign Keys but the database doesn't have any related records with required Primary Keys. I...
3
by: frizzle | last post by:
Hi there, I'm building a multi-language PHP/mySQL -site. I'm also building a CMS for the site. There are 5 languages. In the CMS fields for e.g. english bodytext are called (id=)...
1
by: Michelle A. | last post by:
I have a 4 page form. First page has a series of check boxes of different "opportunities" to select from. These check boxes are optional but they have to at least select one (or fill in the...
1
by: sianan | last post by:
I tried to use the following example, to add a checkbox column to a DataGrid in an ASP.NET application: http://www.codeproject.com/aspnet/datagridcheckbox.asp For some reason, I simply CAN'T get...
4
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to...
11
by: Naeem | last post by:
I have a Javascript function, which changes a text field of a form into a select field. Following is the function function changeStateField() { var myForm =...
4
by: JBiggsCC | last post by:
I have a very simple login page which takes an ID number via a HTML form GET. What is easiest way to check that ID number against an Access DB to see if it exists? I want to redirect with the...
3
by: Search & You Will Find | last post by:
I have a database in Access 2000 that I need some help on. I have three tables: PROJECTS, SYSTEMS, & SYSTEMSREF. They possess the following fields: -----------------------------------...
0
by: readnlearn | last post by:
hai, i have written this below code for displaying captcha image whenever i entered incorrect uname,password in login page. for that i disable the controls of captcha like textbox,labels,button and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.