How can I add new components to a fieldset? 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 &lt;= 5; $j++) {
  $node-&gt;webform['components'][$i] = array(
    'nid' =&gt; $node-&gt;nid,
    'cid' =&gt; $i,
    'pid' =&gt; 0,
    'form_key' =&gt; "participant$j",
    'name' =&gt; "Participant",
    'type' =&gt; 'fieldset',
    'value' =&gt; '',
    'weight' =&gt; $j,
    'display' =&gt; array(
      'addmore' =&gt; $i,
    ),
    'extra' =&gt; array(
      'description' =&gt; 'Please provide the participant information listed below. Required items are denoted with an asterisk.',
      'title_display' =&gt; 0,
      'private' =&gt; 0,
      'collapsible' =&gt; 1,
      'conditional_component' =&gt; '',
      'conditional_operator' =&gt; '=',
      'conditional_values' =&gt; '',
    'mandatory' =&gt; 0,
    'page_num' =&gt; 1,
    ),
  );
  $i++;

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

    'parent' =&gt; "participant$j",
    'extra' =&gt; array(
      'display' =&gt; array(
        'addmore' =&gt; $i,
      ),
      'title_display' =&gt; 'inline',
      'private' =&gt; 0,
      'disabled' =&gt; 0,
      'unique' =&gt; 0,
      'maxlength' =&gt; 60,
      'width' =&gt; '',
      'field_prefix' =&gt; '',
      'field_suffix' =&gt; '',
      'description' =&gt; '',
      'attributes' =&gt; array(),
      'conditional_component' =&gt; '',
      'conditional_operator' =&gt; '=',
      'conditional_values' =&gt; '',
    'mandatory' =&gt; 1,
    'page_num' =&gt; 1,
    ),
  );
  $i++;
...
It looks like setting the pid to the parent fieldset's cid achieves my goal.