Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Limit of number of dropdowns selected

Reply
Thread Tools

Limit of number of dropdowns selected

 
 
ll
Guest
Posts: n/a
 
      06-07-2006
This script contains the check for a single drop down; however, I am
needing to check to make sure that only one of my seven drop down boxes
is selected - is there a way to assign a count variable (increment)
whenever a drop down is selected and thus use that in the checking
mechanism, or would there be a simpler way?

Thanks


>
> =======================
> <script language="JavaScript">
> // last name
>
> function checkLastName (strng) {
> var error = "";
> if (strng == "") {
> error = "Please enter your last name.\n\n";
> }
> return error;
> }
>
> // department
>
> function checkDepartment (strng) {
> var error = "";
> if (strng == "") {
> error = "Please enter your department.\n\n";
> }
>
> return error;
> }
>
> // valid selector from dropdown list
>
> function checkClassSession(choice) {
> var error = "";
> if (choice == 0) {
> error = "Please choose a class session from the drop-down
> list.\n\n";
> }
> return error;
> }
>
>
> <!-- Begin check form script -->
> <!--
> function checkWholeForm(theForm) {
> var why = "";
> why += checkLastName(theForm.last_name.value);
> why += checkDepartment(theForm.department.value);
> why += checkClassSession(value);
> if (why != "") {
> alert(why);
> return false;
> }
> return true;
> }
> // -->
> </script>
>
> ---------
> here is the way it's called in the body:
> <form name="theForm" method="post" onsubmit="return
> checkWholeForm(this)"
> action="http://www.domain.com/cgi-bin/genform.pl?(E-Mail Removed)">
> ----------
>
> Thanks again,
> Louis
>
>


 
Reply With Quote
 
 
 
 
ll
Guest
Posts: n/a
 
      06-07-2006

ll wrote:
> This script contains the check for a single drop down; however, I am
> needing to check to make sure that only one of my seven drop down boxes
> is selected - is there a way to assign a count variable (increment)
> whenever a drop down is selected and thus use that in the checking
> mechanism, or would there be a simpler way?
>
> Thanks
>
>
> >
> > =======================
> > <script language="JavaScript">
> > // last name
> >
> > function checkLastName (strng) {
> > var error = "";
> > if (strng == "") {
> > error = "Please enter your last name.\n\n";
> > }
> > return error;
> > }
> >
> > // department
> >
> > function checkDepartment (strng) {
> > var error = "";
> > if (strng == "") {
> > error = "Please enter your department.\n\n";
> > }
> >
> > return error;
> > }
> >
> > // valid selector from dropdown list
> >
> > function checkClassSession(choice) {
> > var error = "";
> > if (choice == 0) {
> > error = "Please choose a class session from the drop-down
> > list.\n\n";
> > }
> > return error;
> > }
> >
> >
> > <!-- Begin check form script -->
> > <!--
> > function checkWholeForm(theForm) {
> > var why = "";
> > why += checkLastName(theForm.last_name.value);
> > why += checkDepartment(theForm.department.value);
> > why += checkClassSession(value);
> > if (why != "") {
> > alert(why);
> > return false;
> > }
> > return true;
> > }
> > // -->
> > </script>
> >
> > ---------
> > here is the way it's called in the body:
> > <form name="theForm" method="post" onsubmit="return
> > checkWholeForm(this)"
> > action="http://www.domain.com/cgi-bin/genform.pl?(E-Mail Removed)">
> > ----------
> >
> > Thanks again,
> > Louis
> >
> >


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selected ListItem in DropDownList does not appear selected Nathan Sokalski ASP .Net 0 10-05-2008 10:29 PM
Limit number of selected values in listbox Doogie ASP .Net 1 09-29-2008 04:28 PM
Some shareware has a time limit and the software will not work after the time limit has expired. anthony crowder Computer Support 20 01-16-2007 10:01 AM
DropDownList 2 always returns Selected = 0 for all items - even selected item Iain ASP .Net 3 12-11-2006 11:07 AM
c program, file size limit, how to solve? 2G bytes limit. guru.slt@gmail.com C++ 1 06-27-2005 11:05 PM



Advertisments