Bug Tracker

Opened 11 years ago

Closed 10 years ago

#4213 closed enhancement (worksforme)

[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.

Change History (2)

comment:1 Changed 11 years ago by joern

Component: unfilledplugin
need: ReviewTest Case
Owner: set to joern

comment:2 Changed 10 years ago by joern

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.

Note: See TracTickets for help on using tickets.