I have a select list form element set up with #ahah_bindings. The event is set to change. How do I reference the value the user has selected in my php function? Can I pass it with the #ahah_bindings params?
Thanks
I have a select list form element set up with #ahah_bindings. The event is set to change. How do I reference the value the user has selected in my php function? Can I pass it with the #ahah_bindings params?
Thanks
Comments
Comment #1
drenton commentedI'm trying to retrieve these values under the $_POST variables. Everything works fine except for the CCK fields.
For example, in hook_form_alter(), the CCK field looks like this :
$form['field_myfield']['key'] .....
So all the element attributes are stored under the 'key' array. This is also where I attach the #ahah_bindings like this :
$form['field_myfield']['key']['#ahah_bindings'] = array (
array(
'event' => 'change',
'path' => 'mypath',
'wrapper' => 'target'
) ,
);
The only thing that makes it to the $_POST is ['field_myfield'] and it always has a NULL value.
Any ideas ?
Thanks
Comment #2
aeeckhau commentedHad the same problem and couldn't find a solution till I had a look at the ahah_form.js file.
I changed the following lines
into
or better (to maintain names of other element-types):
in $_POST['selecteditems'] you will be able to find the changed select item and its value
Comment #3
starbow commented