drupal fapi and jquery validation

bouton - January 16, 2009 - 17:28
Project:jQuery plugins
Version:6.x-1.6
Component:Code
Category:support request
Priority:normal
Assigned:Unassigned
Status:closed
Description

Hey - this is great. Just what I needed. I have a form I have wriiten via FAPI in a module. This validates it great.
Just one question/problem.
How do I write the rule for checkboxes when drupal putputs the name as
test[one]
test[two]

rather than just test[]

I want to validate the checkboxes such that at least one in
the group must be checked.

thanks

K

#1

nickl - May 18, 2009 - 04:14

Have you tried the :unchecked selector?

    function countUnchecked() {
      var n = $("input:unchecked").length;
      $("div").text(n + (n == 1 ? " is" : " are") + " unchecked!");
    }
    countUnchecked();
    $(":checkbox").click(countUnchecked);

if you want all the elements with test in their name try the attributeContains selector.

    $('input[name*="test"]').css('border', '2px solid red');

#2

nickl - June 1, 2009 - 23:43
Status:active» fixed

Killing active issues

#3

System Message - June 15, 2009 - 23:50
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.