Quote OP:
"do new rules for each select menu have to be created on the fly?"
Yes. After the plugin is first initialized you can only declare new rules using methods provided by the plugin. See the .rules('add')
method.
Create the new element and then call this…
$('#myselect').rules('add', { // <- select a single element
require_from_group: [1, '.reccomendations']
});
If you create more than one element at a time, then you must wrap it within a jQuery .each()
…
$('.select').each(function() { // <- select a group of elements
$(this).rules('add', {
require_from_group: [1, '.reccomendations']
});
});
NOTE:
If you use the same class
selector as for the require_from_group
, the code can be condensed to this…
$('.reccomendations').each(function() {
$(this).rules('add', {
require_from_group: [1, this]
});
});
"Can I just validate the entire group with 1 rule?"
No. You must apply the rule to every element in the group.
IMPORTANT:
No matter how you create the elements and declare the rules, each element must contain a unique name
attribute. This is how the plugin keeps track of the inputs.