Closed (fixed)
Project:
Drupal core
Version:
6.4
Component:
forms system
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
8 Oct 2008 at 13:15 UTC
Updated:
16 Jan 2009 at 20:40 UTC
Hi all,
This is driving me a bit mad, as I can't see why this isn't working - it's a form function called in the usual way in a preprocess function using drupal_get_form(); ... it renders the fieldset no problem, but ignores the #collapsible item. Form code is:
function image_title_menu_router_form() {
$item = menu_get_item();
//load any existing file data
$image_title = db_fetch_array(db_query('SELECT image FROM {image_title_menu} WHERE path = "%s"', $item['path']));
$picture = theme('image_title', $image_title['image']);
$collapsed = TRUE;
if ($picture) {
$collapsed = FALSE;
}
$form = array();
$form['menu_router_item'] = array(
'#type' => 'value',
'#value' => $item,
);
$form['#attributes']['enctype'] = 'multipart/form-data';
$form['image_title_upload'] = array(
'#type' => 'fieldset',
'#title' => t('Title image'),
'#collapsible' => TRUE,
//'#collapsed' => $collapsed,
);
$form['image_title_upload']['image_title_upload'] = array(
'#type' => 'file',
'#title' => t('Attach title image'),
'#size' => 40,
);
if ($picture) {
//show the image
$form['image_title_upload']['current_title_image'] = array('#value' => $picture);
//set the delete flag
$form['image_title_upload']['image_title_delete'] = array(
'#type' => 'checkbox',
'#default_value'=> 0,
'#title' => t('Delete title image.'),
);
}
$form['image_title_upload']['submit'] = array(
'#value' => t('Save title image settings'),
'#type' => 'submit',
);
return $form;
}
Comments
Comment #1
ainigma32 commentedI'm not sure but maybe it only works if you add both #collapsed and #collapsible
Please post back your findings.
- Arie
Comment #2
greg.harveyHmm, I'd forgotten all about this and it's working now - will take a look what changed.
Comment #3
ainigma32 commentedLooks like greg.harvey won't be posting any feedback so I'm setting this to fixed.
Feel free to reopen if you you think that is wrong.
- Arie
Comment #4
greg.harveySure - sorry ... I'm away now and I really can't figure out what "fixed" it, but it is fixed. Apologies I can't provide more info. =(