Search the web
Sign In
New User? Sign Up
validation · Techniques for HTML form validation
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Multiple Select List   Message List  
Reply | Forward Message #373 of 427 |
RE: [validation] Re: Multiple Select List

I was afraid that custom validation was going to be the answer... This page
has about 300 lines of Javascript field validation code. I was hoping to use
Validate to eliminate that code.



Of course if all the multiple select fields have the same Default value then
I could probably code a general purpose custom validation for the
multiple-select boxes... Hmm... I'll have to think about this one...



Richard W. Schaefer | HTSC Application Development & Maintenance |
860.547.5176





-----Original Message-----
From: somematt [mailto:matthew.a.frank@...]
Sent: Thursday, February 10, 2005 9:17 AM
To: validation@yahoogroups.com
Subject: [validation] Re: Multiple Select List




the code for determining the value of a select-multiple:

**************************************
case "select-multiple" :
for(var i=0,iOptions=element.options.length; i<iOptions; i++)
if(element.options[i].selected &&
trim(element.options[i].value.toString())){
returnValue=true;
break;
}
break;
**************************************

if there is at least one option selected that has a non-empty value,
the control will pass required validation. if you want to include 0
as an empty value, you can alter the logic in your copy of the script
or you can create a custom onvalidate handler that accomplishes the
same thing.



--- In validation@yahoogroups.com, "rschaeferiii"
<Richard.Schaefer@t...> wrote:
>
> I have an input field in a form that is <SELECT MULTIPLE
> NAME="mslist" REQUIRED="on">. If I fill in the form and Submit it I
> don't get any validation error that nothing was selected. Could this
> be because the default ("empty") first entry is "selected"? If so is
> there a way to check that at least one entry is selected AND the
> value is <> "" (or <>0 depending on the list...).
>
> I'm running v3.1.4.








Yahoo! Groups Sponsor



ADVERTISEMENT

<http://us.ard.yahoo.com/SIG=129nqj85u/M=298184.6018725.7038619.3001176/D=gr
oups/S=1705007709:HM/EXP=1108131466/A=2532114/R=2/SIG=12klsila3/*http:/clk.a
tdmt.com/NFX/go/yhxxxnfx0020000014nfx/direct/01/&time=1108045066516868>


<http://view.atdmt.com/NFX/view/yhxxxnfx0020000014nfx/direct/01/&time=110804
5066516868>



<http://us.adserver.yahoo.com/l?M=298184.6018725.7038619.3001176/D=groups/S=
:HM/A=2532114/rand=375989448>



_____

Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/validation/
<http://groups.yahoo.com/group/validation/>


* To unsubscribe from this group, send an email to:
validation-unsubscribe@yahoogroups.com
<mailto:validation-unsubscribe@yahoogroups.com?subject=Unsubscribe>


* Your use of Yahoo! Groups is subject to the Yahoo! Terms of
<http://docs.yahoo.com/info/terms/> Service.



This communication, including attachments, is for the exclusive use of
addressee and may contain proprietary, confidential or privileged
information. If you are not the intended recipient, any use, copying,
disclosure, dissemination or distribution is strictly prohibited. If
you are not the intended recipient, please notify the sender
immediately by return email and delete this communication and destroy all
copies.



[Non-text portions of this message have been removed]




Thu Feb 10, 2005 2:28 pm

rschaeferiii
Offline Offline
Send Email Send Email

Forward
Message #373 of 427 |
Expand Messages Author Sort by Date

I have an input field in a form that is <SELECT MULTIPLE NAME="mslist" REQUIRED="on">. If I fill in the form and Submit it I don't get any validation error...
rschaeferiii
Offline Send Email
Feb 10, 2005
3:27 am

the code for determining the value of a select-multiple: ************************************** case "select-multiple" : for(var...
somematt
Offline Send Email
Feb 10, 2005
2:17 pm

I was afraid that custom validation was going to be the answer... This page has about 300 lines of Javascript field validation code. I was hoping to use ...
Schaefer, Richard W (...
rschaeferiii
Offline Send Email
Feb 10, 2005
2:29 pm

at that point, i'd just update the script. i think that's the path of least resistance. ... This page ... hoping to use ... value then ... ...
somematt
Offline Send Email
Feb 10, 2005
2:46 pm

Something like? case "select-multiple" : for(var i=0,iOptions=element.options.length; i<iOptions; i++) if(element.options[i].selected && ...
Schaefer, Richard W (...
rschaeferiii
Offline Send Email
Feb 10, 2005
2:52 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help