469,275 Members | 1,804 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,275 developers. It's quick & easy.

multiple select box validation

hi,

i am shanmugam.i am new to this forum.i need mutipe select box validation.


Thank you....
Feb 25 '08 #1
13 2578
acoder
16,027 Expert Mod 8TB
Please remember to provide a meaningful Title for any threads started (see the FAQ entry Use a Good Thread Title).

This helps to ensure that other members, and also the general public, will have a better chance of finding answers to any similar questions.

Moderator.
Feb 25 '08 #2
acoder
16,027 Expert Mod 8TB
i need mutipe select box validation.
What code do have so far? Post your code so we can work with that. Also explain exactly what kind of validation is required.
Feb 25 '08 #3
sorry for the mistake....

here is my code.....
[HTML]var len=document.form1.select1.length;
for(i=0;i<len;i++)
{
if(document.form1.select1[i].value)
{
flag="false";
break;
}
}
if(flag==false)
{
alert("select value");
}[/HTML]
my error is object required

in php select1[] is name of select button
pls help.....
Feb 25 '08 #4
acoder
16,027 Expert Mod 8TB
Threads merged. Please do not double post. Thanks!
Feb 25 '08 #5
sorry for the mistake....

here is my code.....

Expand|Select|Wrap|Line Numbers
  1. var len=document.form1.select1.length;
  2. for(i=0;i<len;i++)
  3. {
  4. if(document.form1.select1[i].value)
  5. {
  6. flag="false";
  7. break;
  8. }
  9. }
  10. if(flag==false)
  11. {
  12. alert("select value");
  13. }
  14.  
my error is object required

in php select1[] is name of select button
pls help.....
code
Feb 25 '08 #6
hsriat
1,654 Expert 1GB
sorry for the mistake....

here is my code.....

Expand|Select|Wrap|Line Numbers
  1. var len=document.form1.select1.length;
  2. for(i=0;i<len;i++)
  3. {
  4. if(document.form1.select1[i].value)
  5. {
  6. flag="false";
  7. break;
  8. }
  9. }
  10. if(flag==false)
  11. {
  12. alert("select value");
  13. }
  14.  
my error is object required

in php select1[] is name of select button
pls help.....
code
What do you intend to do with this code?
Feb 25 '08 #7
What do you intend to do with this code?
user select atlest one option...otherwise so alert msg....
Feb 25 '08 #8
acoder
16,027 Expert Mod 8TB
Instead of
Expand|Select|Wrap|Line Numbers
  1. if(document.form1.select1[i].value)
use .selected to test for selection.
Feb 25 '08 #9
any one help me for a select box validation how to validate pls.......help..............
Expand|Select|Wrap|Line Numbers
  1. <select name=selcie[] >
  2. <option value="chennai">chennai</option>
  3. <option value="Delhi">Delhi</option>
  4. <option value="salem">salem</option>
  5. </select>
  6.  
Feb 25 '08 #10
hsriat
1,654 Expert 1GB
user select atlest one option...otherwise so alert msg....
Give selected attribute to one of the options you want to be default.
Feb 25 '08 #11
Give selected attribute to one of the options you want to be default.
[HTML]Thank you for your response.acually i display selected option in database also. that is previosly selected option also display if i give selected any one it will create duplicate.
so i need any other solution pls.....[/HTML]
Feb 25 '08 #12
hsriat
1,654 Expert 1GB
Thank you for your response.acually i display selected option in database also. that is previosly selected option also display if i give selected any one it will create duplicate.
You need to work on your algorithm.

so i need any other solution pls.....
Look at post # 9
Feb 25 '08 #13
acoder
16,027 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. <select name=selcie[] >
  2. <option value="chennai">chennai</option>
  3. <option value="Delhi">Delhi</option>
  4. <option value="salem">salem</option>
  5. </select>
  6.  
You also need to make this select element multiple, e.g. <select name="selcie[]" multiple> otherwise you won't be able to make multiple selections.
Feb 25 '08 #14

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by TJS | last post: by
1 post views Thread by Ken Varn | last post: by
2 posts views Thread by aris1234 | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.