protected function getTargetFieldCondition($field, $state) { FormBootstrapper::requirements(); if ($field instanceof FormField) { $prefix = strpos($state, '[') === 0 ? '' : ':'; if ($field->Form) { $condition = '#' . $field->ID() . $prefix . $state; } else { $condition = "[name='" . $field->ID() . "']" . $prefix . $state; } } else { $condition = $field . ':' . $state; } return $condition; }