Posted by tahiche on February 22, 2011 at 6:27pm
2 followers
Jump to:
| Project: | AHAH helper |
| Version: | 6.x-2.1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Hi:
My form was working ok until I added a filefield. Now the AHAH is not working properly.
The filefield module somehow alters the $form_state object and values are lost.
More specifically:
Here´s a select box that triggers ahah and thus a form change:
$form['etiquetas']['tectag_1'] = array(
'#type' => 'select',
'#title' => t('Tag'),
'#size' => 1,
'#options'=>makePrimaryTree($form,$form_state),
'#prefix' => '<div id="tagwrapper-'. $i.'">',
'#suffix' => '</div>',
'#default_value' => $form_state['values']['etiquetas']['tectag_'. $i],
'#multiple' => false,
'#ahah' => array(
'event' => 'change', // When the button is "clicked", AHAH will do it's job
'path' => ahah_helper_path(array('etiquetas')),
'wrapper' => 'etiquetas-wrapper', // We then define the wrapper which will be changed.
),
);Ok, so that runs the form_alter function on the event 'change'.
Without the filefield module:
drupal_set_message('Form state here:'. print_r($form_state['etiquetas']['values'], TRUE) .'');
Will output:
[etiquetas] => Array
(
[tectag_1] => 29
[add_more] => Agrerar Campo Tecnología
)But with the filefield module on the form it is:
[etiquetas] => Array
(
[tectag_1] =>
[add_more] => Agrerar Campo Tecnología
)So it´s not getting the actual selected value and thus I can´t go any further.
Hope it´s clear enough and that someone can help.
Thanks in advance
Comments
#1
I am having what I think is the same problem. I have a dependent dropdown box in the same form as a file field. The dropdown box does not work right unless I took out the file field. I ran across a note at http://drupal.org/node/806500 that lead me to try removing jQuery Update, and that fixed the problem. Now I have to find out how to make it work with jQuery Update enabled. (next morning:) I renabled jQuery Update and tried some of the patches talked about in http://drupal.org/node/806500 and it seems to be fixing the problem.