Re: [development] ahah, drupal_json, file_uploads....
So I've ran into an interesting issue, and wanted to solicit feedback from people more involved with ahah/ajax development for drupal than I.... http://malsup.com/jquery/form/#code-samples -- see the file uploads tab and the information regarding json/javascript responses. The concrete issue I'm dealing with is the Add another item button for CCK... For Filefield if you've selected a file to upload and press the 'Add Another Item' button you get an error. You get this error because drupal_json sets the text/javascript header, and the iframe doesn't accept that... This issue can be solved easily just by having CCK's ahah handler simply print drupal_to_js instead of using drupal json. This however will not solve more systemic issues with people adding file uploads to other ajax handled forms. There are a couple solutions I can think of... 1) have ahah set the iframe option to true and use iframes, and add the textarea to drupal_json. 2) check the _SERVER['HTTP_ACCEPT'] and decide which header to set whether to wrap output in a textarea 3) hack around it on a case by case basis I was hoping some of the more jquery ahah astute might have better suggestions for achieveing some kind of consistency. We should probably add $_GLOBAL['devel_shutdown'] = FALSE to drupal_json regardless... .darrel.
participants (1)
-
Darrel O'Pry