Hi, about ahah in form. i'm new in this part and i found it really hard to make it work.
Below is the code:
$form['xxx']['yyy'] = array(
'#type' => 'select',
'#title' => t('title'),
'#default_value' => $id,
'#options' => $arr,
'#description' => t('The desc.'),
'#required' => TRUE,
'#ahah' => array(
'event' => 'change',
'path' => 'menu/path',
'wrapper' => 'the-div-wrapper',
'method' => 'replace',
),
);
$form['xxx']['zzz'] = _function_to_get_element($id); // this is also a selection element
The logic is when i select the 'yyy' element, i want to update the 'zzz' element content according to the 'yyy' selection value.
I tried many times, when i change 'yyy' selection, nothing happens. I don't konw why.
Any suggestions appreciated!
Thanks!
Comments
Add prefix and suffix
you might want to add a prefix and suffix so you can contain your 'zzz'.
$form['xxx']['zzz'] =.......
'#prefix' => '<div id="zzz-wrapper">',
'#suffix' => '</div>
Then make your ahah target the 'zzz-wrapper'
i have tried this, but it
i have tried this, but it seems that ahah didn't add the handler to the selection box. Because when i change the selection, nothing happened, even if the progressing bar.
Have you defined your AHAH
Have you defined your AHAH callback function?
Full-time freelancer, always looking for work.
jaypan.com (my portfolio)
of course, i did define the
of course, i did define the callback
Then your problem is probably
Then your problem is probably in there.
Full-time freelancer, always looking for work.
jaypan.com (my portfolio)