I have two fields: Premium and Standard. Between those two fields, I need to ensure that they choose at least two but no more than three values.

It seems like maybe I could use a combination of those two validators. Does that seem possible?

Comments

mrpeanut’s picture

Category: support » bug

I partially solved this by using the Field collection module. That module combines my two fields (Premium and Standard). However, upon setting a field validation for the combined field, I get this error:

Notice: Undefined index: value in field_validation_field_attach_validate() (line 43 of C:\Program Files\wamp\www\drupal\sites\all\modules\field_validation\field_validation.module).

Here's my field validation export:

$rule = new stdClass();
$rule->disabled = FALSE; /* Edit this to true to make a default rule disabled initially */
$rule->api_version = 2;
$rule->rulename = 'Flavor selection';
$rule->name = 'flavor_selection';
$rule->field_name = 'field_flavors_field_collection';
$rule->col = 'value';
$rule->entity_type = 'commerce_line_item';
$rule->bundle = 'sampler';
$rule->validator = 'field_validation_number_of_selections_validator';
$rule->settings = array(
  'min' => '2',
  'max' => '3',
  'errors' => 1,
);
$rule->error_message = 'You must choose three flavors.';

I assume the issue arises from $rule->col = 'value';, but I don't know where to go from there to fix it.

g089h515r806’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

It is not a bug, I think you make a mistake in your config.