I'm running into two problems with form elements added to by AHAH:

  1. Elements with the #ahah property don't work unless Javascript settings are already on the page. So new elements with the #ahah property don't work.
  2. A file upload element requires the form enctype attribute to be set to "multipart/form-data". Adding a new file upload element can set this attribute in the server's cached copy of the form, but it doesn't change the setting in the browser.

For my current project I hacked around the problem by adding AHAH settings for all possible form elements that might be added to the page and by adding the enctype attribute "multipart/form-data" even when the initial form contains no file elements. This seems like a bug in AHAH form processing.

Comments

darren oh’s picture

Project: Drupal core » Documentation
Version: 6.x-dev »
Component: forms system » Developer Guide

A missing documentation bug. AJAX with 6.x FormAPI needs to be updated. CCK's content_add_more_js() function provides a good example for how to deal with this issue.

nielsbom’s picture

Component: Developer Guide » Outdated

Changed the component to reflect the new component categorization. See http://drupal.org/node/301443
-nielsbom

add1sun’s picture

Status: Active » Fixed

That page has been deprecated and a whole new section on using AJAX/AHAH has been written and updated.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.