Posted by Apfel007 on September 15, 2011 at 11:12am
1 follower
| Project: | AHAH helper |
| Version: | 6.x-2.2 |
| Component: | Documentation |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi,
how would you prefill a form element with value from a select list? What I have to do to transmit values via from one element to an other?
$form['profile_img_download']['format'] = array(
'#type' => 'select',
'#title' => t('Choose format for download'),
'#redirect' => '',
'#options' => $form['path_options']['#value'],
'#default_value' => $usage_default_value,
'#ahah' => array(
'event' => 'change',
// This is the "magical path". Note that the parameter is an array of
// the parents of the form item of the wrapper div!
'path' => ahah_helper_path(array('profile_img_download', 'format')),
'wrapper' => 'dependent-dropdown-wrapper',
// 'event' => 'change', // default value: does not need to be set explicitly.
),
'#attributes' => array('class' => 'master-dropdown'),
'#description' => t(''),
);
$form['profile_img_download']['download'] = array(
'#type' => 'textfield',
'#title' => t('Company name'),
'#required' => TRUE,
'#size' => 20,
'#maxlength' => 255,
// If the user switched to Private usage and back to Company usage, we
// remembered his company's name!
//'#default_value' => $form_state['storage']['profile_img_download']['format'],
'#default_value' => 'name',
);