Skip to main content

Bug Tracker

Side navigation

#4213 closed enhancement (worksforme)

Opened February 22, 2009 10:13PM UTC

Closed June 10, 2009 12:00PM UTC

[validate] Allow for the ability to add groups

Reported by: cfjedimaster Owned by: joern
Priority: minor Milestone: 1.4
Component: plugin Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

Currently you can only group fields when you initialize the validate constructor. In a form where items are added dynamically, it would be nice to have the ability to add groups dynamically as well. For example, I like to group firstname and lastname fields. My form allows me to add N people. I want to group each new set into one group so I can have one error message per 'set' of fields.

Attachments (0)
Change History (2)

Changed February 23, 2009 07:24AM UTC by joern comment:1

component: unfilledplugin
need: ReviewTest Case
owner: → joern

Changed June 10, 2009 12:00PM UTC by joern comment:2

resolution: → worksforme
status: newclosed

Considering that each field has to have a unique name, you should be able to generate enough groups up front. Something like this:

// max 100
var groups = {};
for(var i = 0; i < 100; i++) {
  groups["group" + i] = "firstname" + i + " lastname" + i ;
}

That generates 100 groups, assuming group names of group0, group1 etc. and values of "firstname0 lastname0", "firstname1 lastname1" etc.