Javascript error when disallowing access to image fields
mburak - October 6, 2008 - 17:16
| Project: | CCK Field Permissions |
| Version: | 5.x-1.10 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
I'm getting a "button is undefined" Javascript error when loading a form where i'm not allowed to post image fields.
It seems that the upload.js is being loaded without matter that the module is setting the form access attribute for the field to FALSE.

#1
I believe I'm experiencing this same problem. In IE it is stops the rest of my javascript from completing and leaves the users without FCKEditor.
#2
Does anyone know of a solution to this problem? Or can possibly point me in the right direction to solve it. Thanks
#3
i have the same problem, does anyone have a solution?
#4
Same problem here!! I changed priority to critical because it makes the module useless to me, because other modules are not working when cck field permissions is turned on for image fields.
Nobody here who has a solution??
Please contact me, I am willing to honor working solutions with little extra money! ;)
#5
I did have some further research on this, because I really need to get this module working.
There is a module called Workflow Fields, which does not exactly do what CCK Field Permissions can do, but it can also make certain cck fields invisible.
If an image field is set invisible there is also an JS error, BECAUSE the javascript settings of the upload part of the form are not removed. This is critical because the collapsible fieldsets in the form stop working and stay collapsed. (http://drupal.org/node/238525)
They posted a patch which looks like that:
if ($field['type'] == 'file') {unset($form[$key .'-attach-url']);
}
SO we would really need a patch like that. Actually I am no PHP pro, so I would appreciate if someone with some knowledge in that can help us out here!
Like I said, I am willing to support your help with a little extra money. Please contact me.
#6
Thanks tu ufku (http://drupal.org/user/9910) I got a working patch:
change
$form[$disallowed_field]['#access'] = false;
to
$form[$disallowed_field]['#access'] = false; if (isset($form[$disallowed_field .'-attach-url'])) {
$form[$disallowed_field .'-attach-url']['#access'] = false; }
and change
unset($form[$name]);
to
unset($form[$name]);
if (isset($form[$name .'-attach-url'])) {
$form[$name .'-attach-url']['#access'] = false; }