[support] [D6] ahah send the whole form on each change (editing cck nodes)
Daniel Caillibaud
ml.dcailli at free.fr
Mon Sep 15 22:18:44 UTC 2008
Hi all,
I wanted to send an httpRequest for each change in taxonomy multiselect fields (when editing cck nodes).
I tried to add a ['#ahah'] param to all my taxonomy form entries, it works, but the WHOLE form is sent each time a select
change. I expected to send only the form entry concerned.
Is this "normal" or is there another way to do this with ahah ? (D6, cck 6.x-2.0-rc6)
At the end, I found a solution without ahah, writing an external js file instead of ahah params in drupal $form, but I'm
curious about ahah use.
My code :
// in my hook form_alter
foreach ($form['taxonomy'] as $vid => $taxonomy_entry) {
if ($taxonomy_entry['#type'] == 'select') {
$form['taxonomy'][$vid]['#ahah'] = array(
'path' => 'eduforge/taxonomy_change/' .$vid,
'event' => 'change',
'wrapper' => 'eduforge_taxonomy_change_output',
'method' => 'replace',
'effect' => 'fade',
);
}
}
// in hook menu
$items['eduforge/taxonomy_change/%'] = array (
'page callback' => 'eduforge_taxonomy_change',
'page arguments' => array (2),
'type' => MENU_CALLBACK,
/// ...
);
function eduforge_taxonomy_change($vid) {
// here, $_POST contains the whole form
// some code
drupal_json(array('status' => TRUE, 'data' => $returned_datas));
}
Thanks for advices
Daniel
More information about the support
mailing list