How do I get a checkbox widget to display in views?
I'm working on an admin view. This is a list of events where a checkbox widget needs to be exposed for the authorized user to check and uncheck a value that will be updated as 1 or 0 (true or false) in the node's database record. (Eventually I wish to add the weight data field as well to reorder the list). The final result of this Views view will be two pages:
- an end-user plain HTML list without a checkbox widget;
- an admin page with *editable widgets* for flag and weight (list order).
This question is only concerned with the admin view. The boolean checkbox does not display on the admin page. I've read somewhere implementation of a checkbox *widget* is a special block and not a checkbox in the list--is this true?
Troubleshooting this I have checked that,
- the widget is in the content type,
- the view has the value which is to be used for the check box displayed and available in the admin View.
- there is a block associated with the admin page in blocks. I set this to a visible region on the blocks page of my theme. (However, no block is being generated, nor do I understand how this functionality would be enabled without some way to select an item in the list.)
How do I get a checkbox widget to display in views?
My settings for content type:
1) Content types >> My Custom content type >> Manage fields; list of fields:
1.1) Custom flag - custom_flag - Boolean Single on/off - checkbox
1.2) Weight - weight - Integer - Text field
2) Content types >> Custom content type >> Manage fields >> FIELD NAME >> Widget type; Field name -> Widget type
2.1) Custom flag -> Widget type: Single on/off checkbox
2.2) Weight -> Widget type: text field
Views:
3) My Views view settings:
3.1) Format: Table;
3.2) Fields: Content: Custom flag (visible, no results: displayed), ; Content: Weight (visible);
3.3) Page settings: Access: None (restrictions)
3.4) Exposed form: Yes, Basic
Blocks:
4) Structure >> Blocks >> Seven
Block: Exposed form: my_views_view;
Region: Content;
+ Settings:
- Pages: Only the listed pages: my_views_view/;
- Content types: My Custom content type;
- Roles: admin;
- Users: Customizable, visible by default;
Example node:
5) [random node] >> Edit -- Custom flag: checeked
Comments
Can you explain in more
Can you explain in more detail what it is that you are trying to accomplish conceptually? It sounds like you are trying to force something into views that doesn't belong.
If you are trying to show a list of events, and allow users to take some action on some/all of those events (such as marking it as a favorite, subscribing to it, etc.), then the module you walk to use is called Views Bulk Operations (VBO).
@brycesenex, I updated the Q. as per your request...
Are you familiar with the Views expose widget settings? That is the focus of this question. Please limit your answers to the Views Moduule and how it implements widgets. Thanks
You need to write a custom
You need to write a custom views field handler that implements the Views Form API (included in all Views 3 releases after May 30th, which means 6.x-3.0-alpha4, 7.x-3.0-RC1 and recent devs).
The advanced help that ships with Views contains documentation about Views Form.
There's also this article: http://thereisamoduleforthat.com/content/vbo-d7-little-help-my-drupal-fr... and an example module in the views issue queue (http://drupal.org/node/769322#comment-4527260)