kodie / gravityforms-repeater

A Gravity Forms add-on that allows specified groups of fields to be repeated by the user.
59 stars 58 forks source link

Repeater field values aren't appearing in `gform_field_validation` filter #76

Open anugupta opened 7 years ago

anugupta commented 7 years ago

Trying to validate a field in the repeater set, using the gform_field_validation filter.

the $values parameter should contain the field values, but instead has this:

{"formId":2,"children":{"8":{"inputs":["input_8"]},"9":{"inputs":["input_9"]},"10":{"inputs":["input_10"]},"11":{"inputs":["input_11"]},"13":{"inputs":["input_13"]}},"repeaterId":"1","repeatCount":2}

Any idea how to get the actual values in there, so I don't need to parse $_POST?

robfrancken commented 7 years ago

@anugupta Have you tried json_decode?

$data = get_object_vars(json_decode('{"formId":2,"children":{"8":{"inputs":["input_8"]},"9":{"inputs":["input_9"]},"10":{"inputs":["input_10"]},"11":{"inputs":["input_11"]},"13":{"inputs":["input_13"]}},"repeaterId":"1","repeatCount":2}'));

foreach($data['children'] as $child) {
    var_dump($child);
}