Validation problem with select object using multiple attribute

G

Griff

Hi!

I'm using JavaScript on an HTML page for form validation. I have a
form value (theForm.ProdType1) which represents a picklist from which
users may make multiple selections; essentially, this is a Select
object with the "multiple" attribute. There are 20 options to choose
from in this object; one of the options (we'll call it option X)
should NEVER be selected with any other option in the object. Let's
say that the user has selected two options, and one of the options is
option X; how can I alert the user that this is not allowed? I'm not
sure how to identify option X's value out of all the values that have
been selected by the user, if the user has made two or more selections
from the picklist.

Thanks!
Griff
 
R

Richard Cornford

Griff said:
I'm using JavaScript on an HTML page for form validation. I have a
form value (theForm.ProdType1)
document.forms['theForm'].elements['ProdType1']

which represents a picklist from which
users may make multiple selections; essentially, this is a Select
object with the "multiple" attribute. There are 20 options to choose
from in this object; one of the options (we'll call it option X)
should NEVER be selected with any other option in the object. Let's
say that the user has selected two options, and one of the options is
option X; how can I alert the user that this is not allowed? I'm not
sure how to identify option X's value out of all the values that have
been selected by the user, if the user has made two or more selections
from the picklist.

Modify the HTML to correspond with the task that it is to perform. You
have one item that, if selected, excludes all others. That is a pair of
radio buttons: "The Item", or: "Choose Items From the List", the other
items go in the select list and the select list is ignored when the "The
Item" radio button is selected. Users will understand clearly designed
and labelled forms.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top