0

I'd like to customize the webform everytime the user saves a webform node. I'm using rules with a custom action that updates the webform when the user saves the node. Looking at devel, I haven't been able to figure out what the proper key to specify a parent fieldset is.

In my action I have the following:

for ($j = 1; $j <= 5; $j++) {
  $node->webform['components'][$i] = array(
    'nid' => $node->nid,
    'cid' => $i,
    'pid' => 0,
    'form_key' => "participant$j",
    'name' => "Participant",
    'type' => 'fieldset',
    'value' => '',
    'weight' => $j,
    'display' => array(
      'addmore' => $i,
    ),
    'extra' => array(
      'description' => 'Please provide the participant information listed below. Required items are denoted with an asterisk.',
      'title_display' => 0,
      'private' => 0,
      'collapsible' => 1,
      'conditional_component' => '',
      'conditional_operator' => '=',
      'conditional_values' => '',
    'mandatory' => 0,
    'page_num' => 1,
    ),
  );
  $i++;

  $node->webform['components'][$i] = array(
    'nid' => $node->nid,
    'cid' => $i,
    'pid' => 0,
    'form_key' => "first_name$j",
    'name' => 'First Name',
    'type' => 'textfield',
    'value' => '',

    'parent' => "participant$j",
    'extra' => array(
      'display' => array(
        'addmore' => $i,
      ),
      'title_display' => 'inline',
      'private' => 0,
      'disabled' => 0,
      'unique' => 0,
      'maxlength' => 60,
      'width' => '',
      'field_prefix' => '',
      'field_suffix' => '',
      'description' => '',
      'attributes' => array(),
      'conditional_component' => '',
      'conditional_operator' => '=',
      'conditional_values' => '',
    'mandatory' => 1,
    'page_num' => 1,
    ),
  );
  $i++;
...

1 Answer 1

0

It looks like setting the pid to the parent fieldset's cid achieves my goal.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.