You can "require" a select in a drop down to be selected by either
validating the field with javascript, if you want to use a title option
like "select an option" as the first item, or by creating the select wi
th
no blank values and setting a default option by using the keyword selec
ted
as follows for EITHER NS or IE
<script>
function validate(myForm){
if(myForm.mySelect.indexOf==0){
itsSelected=false;
}
return itsSelected;
}
</script>
<body>
<form action="" method="POST" onsubmit="return validate(this)">
<select name="mySelect">
<option>Select an option</option>
<option>Option 1</option>
<option>Option 2</option>
<option>Option 3</option>
</select>
//or to do it without javascript
<select>
<option value="" selected>Option 1</option>
<option value="">Option 2</option>
<option value="">Option 3</option>
</select>
//
</form>
</body>
"Christopher Olive" <[EMAIL PROTECTED]> on 02/05/2002 08:42:3
5 AM
Please respond to [EMAIL PROTECTED]
To: CF-Talk <[EMAIL PROTECTED]>
cc:
Subject: RE: cfselect and required=yes
um...yes it does.
christopher olive, cto, vp of web development
atnet solutions, inc.
410.931.4092
http://www.atnetsolutions.com
-----Original Message-----
From: Kola Oyedeji [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, February 05, 2002 4:59 AM
To: CF-Talk
Subject: RE: cfselect and required=yes
One Gotcha to look out for is Netscape *does not* select an option by
default in a dropdown.
Kola Oyedeji
Web developer
Macromedia Certified Advanced ColdFusion 5 Developer
ekeda ltd
http://www.ekeda.co.uk
(+44)020-8429-7300
> -----Original Message-----
> From: Dave Watts [mailto:[EMAIL PROTECTED]]
> Sent: 04 February 2002 19:03
> To: CF-Talk
> Subject: RE: cfselect and required=yes
>
>
> > I can never get the required attribute to work on cfselect
> > is there a trick?
>
> Unless you create a multi-select box, any HTML SELECT, including one
> generated with CFSELECT, will always have an item selected.
> The REQUIRED
> attribute only affects multi-select boxes.
>
> Dave Watts, CTO, Fig Leaf Software
> http://www.figleaf.com/
> phone: 202-797-5496
> fax: 202-797-5444
>
______________________________________________________________________
Get Your Own Dedicated Windows 2000 Server
PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
Instant Activation � $99/Month � Free Setup
http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists