Validation problem with select object using multiple attribute

Discussion in 'Javascript' started by Griff, Apr 13, 2004.

  1. Griff

    Griff Guest

    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
    Griff, Apr 13, 2004
    #1
    1. Advertising

  2. Griff wrote:
    > 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.
    Richard Cornford, Apr 13, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan_W
    Replies:
    1
    Views:
    8,162
    Stefan_W
    Nov 5, 2008
  2. palmiere
    Replies:
    1
    Views:
    388
    Erwin Moller
    Feb 9, 2004
  3. Marc Aymerich
    Replies:
    0
    Views:
    67
    Marc Aymerich
    Nov 24, 2013
  4. Devin Jeanpierre
    Replies:
    12
    Views:
    102
    Steven D'Aprano
    Nov 24, 2013
  5. Chris Angelico
    Replies:
    0
    Views:
    57
    Chris Angelico
    Nov 24, 2013
Loading...

Share This Page