function subform_example_subform1 in Subform 7
Form builder; Subform 1.
1 string reference to 'subform_example_subform1'
- subform_example_wrapperform1 in ./
subform_example.module - Form builder; Wrapper form.
File
- ./
subform_example.module, line 121
Code
function subform_example_subform1($form, &$form_state, $title) {
$form['title'] = array(
'#type' => 'value',
'#value' => $title,
);
$form['bar'] = array(
'#type' => 'textfield',
'#title' => t('Bar (subform 1)'),
'#required' => TRUE,
);
$form['trigger_error'] = array(
'#type' => 'checkbox',
'#title' => t('Trigger error (subform 1)'),
);
$form['select_id'] = array(
'#type' => 'value',
'#value' => isset($form_state['values']['select_id']) ? $form_state['values']['select_id'] : drupal_html_id('ajax_selected_color'),
);
$select_id = drupal_html_id('select');
$form['select'] = array(
'#type' => 'select',
'#title' => t('Select (subform 1)'),
'#options' => array(
'red' => 'red',
'green' => 'green',
'blue' => 'blue',
),
'#ajax' => array(
'callback' => 'subform_example_simple_form_select_callback',
'wrapper' => $select_id,
),
'#prefix' => '<div id="' . $select_id . '">',
'#suffix' => '<div id="' . $form['select_id']['#value'] . '">No color yet selected</div></div>',
);
$form['subform1'] = array(
'#type' => 'subform',
'#subform_id' => 'subform_example_subform2',
'#subform_arguments' => array(
$title . ' - ' . t('Subform1'),
),
);
$form['actions'] = array(
'#type' => 'actions',
);
$form['actions']['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit subform 1'),
'#weight' => 40,
);
return $form;
}