Closed (fixed)
Project:
FileField
Version:
6.x-1.0-beta2
Component:
User interface
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
7 Jul 2008 at 23:33 UTC
Updated:
23 Jul 2008 at 17:14 UTC
Drupal 6.2
Filefield beta2
Apache with Clean URLs on
Firefox 2 with JS enabled
I am able to render a filefield form field using drupal_render('my_file_field');
However, once I click on 'Upload', the entire fieldset disappears.
I've tried to debug, but I need a helpful hint :)
I appreciate your efforts and support, all!
Comments
Comment #1
jpetso commentedFor JavaScript (AHAH) replacements, Filefield relies on the structure of a node edit form and expects the content_field_form() at
$form[$field_name](or$form[$group_name][$field_name]if the filefield lies inside a fieldgroup). If the filefield form element is somewhere else, an empty result is what you'll get. You might have a look at filefield_js() at the bottom of filefield.widget.inc, that function is very close to CCK's AHAH callback and is the best I could come up with.If you've got a good idea on how to make it fit into other form structures than the expected one, I'd be interested in seeing your solution :)
Comment #2
raspberryman commentedThanks for that, jpetso. I will do some experimentation to get drupal_render() to play well with filefield.
In the meantime, do you have any ideas on how I could get drupal_render() to work as-is? I appreciate any insights you may offer.
Cheers!
Comment #3
jpetso commentedIf you place the widget in your form as
$form[$field_name], it should probably work. Btw, how do you retrieve the form that you drupal_render() afterwards?Comment #4
raspberryman commentedHi jpetso,
I theme the node forms considerably, in their own mynodetype-node-form.tpl.php. In them, I execute
<?php print drupal_render('myfieldame'); ?>to display the form field. At the bottom, I also render the id, token, and submit button.The fields I do not want the user to see are set programatically via the formfilter module.
drupal_render() works beautifully for every CCK field type (and for title, body, and taxonomy fields) except filefilter, due to the above issue.
I hope this helps! Thanks again for your insights.
Comment #5
raspberryman commentedI was able to get
<?php print drupal_render('myfieldame'); ?>to work. I was not renderingform_build_id.drupal_render() now works great for all cases, except when "Number of Values" is set to Unlimited
In that case, the button "Add another item" adds a new form field, but also empties out all previous fields.
Here is how I am using drupal_render(), in a
mynodetype-node-form.tpl.phpfile:All other form fields (author, options, etc) are being set programatically by formfilter_filter_form() in the Formfilter module.
Comment #6
jpetso commentedThe "Unlimited" issue was a CCK bug that I fixed already, and the fixes are in the current -rc releases of CCK - please update. I would assume that all of your challenges are resolved now, could you please close this issue as "fixed" if this is the case?
Comment #7
dopry commentedand 6.x-1.x is deprecated and I completely rewrite the form interface for the widgets... You might want to test against 6.x-3.x and reopen if you're still having issues.