Search code examples
drupaldrupal-6wysiwyg

Drupal forms with WYSIWYG and AHAH


I'm trying to have an AHAH-enabled form with WYSIWYG fields in Drupal 6.

Problem

On this custom form, the user can click a button to add new fieldsets and add fieldsets within those fieldsets (so there is a parent-child nesting situation within the form). The addition and removal of fieldsets is handled via AHAH (and the ahah_helper module). Each of the parent and child fieldsets contain two fields which are text areas replaced by a WYSIWYG editor (with the Wysiwyg module using NicEdit 0.9). The problem is that on any AHAH submit, changes to any of the WYSIWYG fields are ignored. It appears as though the changes to the scripted field are not populated back to the HTML fields before submit, so the original value gets posted.

What I've Tried

My first thought for a solution was when the user clicks any of the AHAH buttons, simply remove all of the WYSIWYG fields with their native functionality. The two approaches I've tried haven't worked.

  1. I can't add a click handler to the AHAH buttons themselves. An AHAH submit can add more such buttons, so I'd need a client-side callback function to bind the function on any new buttons. But I can't do that because Drupal doesn't let me modify or add to the client-side callback.

  2. I can't add a click handler to the form container and let the events bubble up because the submit buttons interrupt event bubbling.


Solution

  • I ran into this same problem. Installing the WYSIWYG CCK Integration module solved if for me.

    http://drupal.org/project/wysiwygcck