Multiple Select validation with jquery

Discussion in 'Javascript' started by Alpha Omega, Aug 5, 2010.

  1. Alpha Omega

    Alpha Omega Guest

    Hi,

    I have this multiple select:

    <select id="sel_dest" name="dest_var[]" multiple disabled="disabled"
    size="10">
    <option value="" selected>Destinatario</option>
    <option value="1"> .........
    </select>


    how can i validate (required field) this select with jquery validation
    plugin?

    this code doesn't work:

    $("#register_form").validate({
    rules: {
    dest_var: {
    required: true;
    }
    }
    });
    }
     
    Alpha Omega, Aug 5, 2010
    #1
    1. Advertising

  2. Am 2010-08-05 16:22, Alpha Omega meinte:
    > Hi,
    >
    > I have this multiple select:
    >
    > <select id="sel_dest" name="dest_var[]" multiple disabled="disabled"
    > size="10">
    > <option value="" selected>Destinatario</option>
    > <option value="1"> .........
    > </select>
    >
    >
    > how can i validate (required field) this select with jquery validation
    > plugin?
    >
    > this code doesn't work:
    >
    > $("#register_form").validate({
    > rules: {
    > dest_var: {
    > required: true;
    > }
    > }
    > });
    > }


    While I am not too familiar with the peculiarities of the mentioned
    library (and I can't imagine why one needs a library for such simple
    things), I'm pretty sure that the name of your element is "dest_var[]",
    not just "dest_var".

    Gregor


    --
    http://www.gregorkofler.com
     
    Gregor Kofler, Aug 5, 2010
    #2
    1. Advertising

  3. Alpha Omega

    Alpha Omega Guest

    > While I am not too familiar with the peculiarities of the mentioned
    > library (and I can't imagine why one needs a library for such simple
    > things), I'm pretty sure that the name of your element is "dest_var[]",
    > not just "dest_var".



    I try dest_var[], but it didn't work. My code has problems on IE8...
     
    Alpha Omega, Aug 6, 2010
    #3
  4. Alpha Omega

    rf Guest

    "Alpha Omega" <> wrote in message
    news:i3gcqo$38o$...
    >> While I am not too familiar with the peculiarities of the mentioned
    >> library (and I can't imagine why one needs a library for such simple
    >> things), I'm pretty sure that the name of your element is "dest_var[]",
    >> not just "dest_var".

    >
    >
    > I try dest_var[], but it didn't work.


    Surely the error message you received was not "it didn't work".

    > My code has problems on IE8...


    What problems? Other than the use of JQuery to perform so trivial a task,
    that is.
     
    rf, Aug 6, 2010
    #4
    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. palmiere
    Replies:
    1
    Views:
    417
    Erwin Moller
    Feb 9, 2004
  2. Mr. Wilson
    Replies:
    3
    Views:
    237
  3. Aaron Gray
    Replies:
    20
    Views:
    406
    Lasse Reichstein Nielsen
    Jul 27, 2008
  4. lorlarz
    Replies:
    6
    Views:
    215
    David Mark
    Mar 25, 2010
  5. Generale Cluster
    Replies:
    1
    Views:
    968
    Frobernik
    May 31, 2010
Loading...

Share This Page