Hello all,
I am trying to add a call to javascript on changing the category value. This can be done by catching onChange event on specific category field. I understand that category field is generated by taxonomy module. I do not want to hack OOTB modules.

Please help me in finding a customization point to realize this.

Thanks

Comments

robertDouglass’s picture

Try my activeforms module (not yet released). It allows you to write server-side code that attaches event listeners to any client-DOM object and specify either an already client side function to call, or an AJAX request.

http://groups.drupal.org/node/317

- Robert Douglass

-----
My Drupal book: Building Online Communities with Drupal, phpBB and WordPress

zigma’s picture

am so happy. This is exactly what I was looking for. I feel like you took my requirement and got the module ready in minutes.

Thank you

robertDouglass’s picture

I tried to document it well (including the test module which has real examples) but make sure and ask questions if you run into roadblocks. Also note that there is a pass-by-reference error in PHP5 that I haven't fixed yet, so if you're running PHP5 you'll need to address that.

- Robert Douglass

-----
My Drupal book: Building Online Communities with Drupal, phpBB and WordPress

zigma’s picture

Robert,
First let me admit that i know little php. However with the blessings of drupal resources and google i have been able to survive.

I need your help. Not to write the code but high level explanation where my scripts will have to be written to get the feature i am trying to achieve.

1) Adding a listener to the forum type field when adding a new topic. There are 5 forums- general, support, feedback, Announcement, Junkyard.

When the user clicks on add a thread link, form to add thread is displayed. By default one forum, is selected. So my listener should be called.

If user changes forum type (say from General to support) then again my listener should be called.

2) Listener will display one more form field (drop down field called support_type) if the selected forum is support. If he changes to other forum type then this field should be hidden. I guess this will have to be written using javascript.

Where do you think I should be adding these scripts based on activeforms framework.

Thank you

zigma’s picture

robert,
Everytime I go to a form I get an error. Here is the error message:-
#######################
[Sat May 27 21:02:26 2006] [error] PHP Fatal error: Cannot use object of type stdClass as array in d:\\path_to_drupal\\modules\\activeforms\\activeforms.module on line 179
###################

Thank you

zigma’s picture

I added a check if it's an array. I am not sure if this is correct but i don't get errors.

replaced
if ($component['#type'] == 'activeforms') {
by
if ( is_array($component) && $component['#type'] == 'activeforms') {

I have not yet used this module to implement anything. I was getting this error after i enabled this module.

zigma’s picture

Robert,
Please help me in writing script that will add listener to "forum type" field.

Thank you.

zigma’s picture

I tried to use the test form of function activeforms_test_page() from activeforms_test.module. I used them in a alter_form function of a custom module. And I get following error

########################################
[Sat May 27 23:51:33 2006] [error] PHP Fatal error: Cannot unset string offsets in d:\\path_to_drupal\\modules\\activeforms\\activeforms.module on line 80
########################################

Line#80 as in the error message is:-
if ($element['render-path']) { unset($element['render-path']); }