HighDots Forums  

validation for list?

Macromedia Dreamweaver Macromedia Dreamweaver Discussions (macromedia.dreamweaver)


Discuss validation for list? in the Macromedia Dreamweaver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
catris
 
Posts: n/a

Default validation for list? - 11-19-2004 , 07:18 PM






How do I validate that a user selects an item from a pre-determined list in a form?

Many thanks!

Catalin

Reply With Quote
  #2  
Old   
Mick White
 
Posts: n/a

Default Re: validation for list? - 11-20-2004 , 09:59 AM






catris wrote:

Quote:
How do I validate that a user selects an item from a pre-determined list in a form?

Many thanks!

Catalin
function isOptionSelected(sel){
return sel.selectedIndex>0;
}

This assumes that all items are selectable.
Mick


Reply With Quote
  #3  
Old   
catris
 
Posts: n/a

Default Re: validation for list? - 11-26-2004 , 03:32 PM



Thanks for the reply, but I'm afraid I don't know how (where) to insert tha
function.

I was hoping to get a validation code, similar with what is already there
within forms (i.e. "MM_validateForm('FirstName','','R','LastName','', 'R'")

Thanks!
Catalin


Reply With Quote
  #4  
Old   
Mick White
 
Posts: n/a

Default Re: validation for list? - 11-26-2004 , 08:33 PM



catris wrote:

Quote:
I was hoping to get a validation code, similar with what is already there
within forms (i.e. "MM_validateForm('FirstName','','R','LastName','', 'R'")
<head>
<script>
function isOptionSelected(sel){
if(!sel.selectedIndex){alert("Boo");return false}
return true;
}
</script>
</head>
<body>
<form onsubmit="...
return (document.MM_returnValue && isOptionSelected(this.nameOfSelect);")

<select name="nameOfSelect">

Mick


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.