Posted by chx on March 3, 2007 at 9:51am
6 followers
Jump to:
| Project: | Content Construction Kit (CCK) |
| Version: | 5.x-1.x-dev |
| Component: | General |
| Category: | task |
| Priority: | normal |
| Assigned: | chx |
| Status: | closed (won't fix) |
Issue Summary
It's not like its hard... it would be better if I could test form $form['#programmed'] and refuse if my value was changed but this is pretty much impossible. But it's not a biggie, just when outputting the field it should not be treated as secure.
The module was written by copying text_widget and ripping out everything from it :) so it handles multiple and all.
| Attachment | Size |
|---|---|
| hidden.module.txt | 1.33 KB |
Comments
#1
subscribing.
#2
Shouldn't you also provide a hidden form value for the format selector when $field['text_processing'] is true ?
More generally, I'm trying to figure out the most generic / flexible way of doing this.
I guess that ideally, content.module would provide and handle an option to make a field hidden, whatever its type is. Maybe it is possible with current api - not sure about that.
A little less ideally, the cck bundle could come with a hidden.module, that would implement 'hidden' widgets for bundled field types. Contrib field modules would have to provide their own 'hidden' widgets if they want to.
Then this idea of a hidden widget is probably related to per-field access rights features. I think CCK field permission module provides some level of control on field view / edit rights, but I did not actually review it (plus it seems it does not set form elements to 'hidden', but unsets them completely)
#3
foreach (range($delta, $delta + 2) as $delta) {$form[$field['field_name']][$delta]['value'] = array(
'#type' => 'hidden',
'#default_value' => '',
);
}
Do we need empty form items for hidden fields? I don't think so.
As an affect I think we could also remove the 'process form values' part.
Further I wondered if we could write a general hidden widget, that works with any field without doing it in the content module. Just create form elements with #type value and don't create any empty default values. Actually I would just don't touch the data.
Looking at the text and number module I think this could work.
Of course we could do the same inside the content module, however by doing this as an extra widget, we need no handling of special cases in the content module and people can just plug in their hidden widget like any other.
#4
#type value does not sound too good how could drupal_execute modify that?
#5
ah, right. But we could serialize() the values and stay with the hidden field. So it could be possible to do that generic for every field out there..
#6
Is this still needed in D6? Not sure I understand the goal here.
#7
The D5 version is no longer being supported. Sorry.