Persistent form filtering

chrisada - March 21, 2007 - 03:11
Project:Formfilter
Version:5.x-1.x-dev
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:needs work
Description

I think the "Filter this form" feature has a lot of potential use, but user should be able to choose if the filtering is persistent, e.g. for a particular form. Also, it should be able to make the filtering applied as default to all users.

#1

JohnG - April 15, 2007 - 11:24

+1 this makes sense to me.

#2

nedjo - April 15, 2007 - 15:29

I don't fully understand the suggested changes. Can you explain more? What doesn't persist at present? What would persist?

I believe there is the ability to make the filtering apply to all users (except UID 1)--just don't give any users the permission to view forms without filtering.

#3

JohnG - April 16, 2007 - 16:48

Apologies to you nedjo for sloppy testing on my part:

I hadn't realised that the form filter settings automatically 'save' themselves, and by default the filtered form is not shown to Admin (user/1)
... so I couldn't understand how to get the formfilters to stick ;P

Perhaps we could start work on a little light documentation ;)

#4

nedjo - April 16, 2007 - 17:08

Perhaps we could start work on a little light documentation ;)

Point taken :) And, hey, anything you might want to post to that effect would be very welcome.

#5

JohnG - April 17, 2007 - 14:37

How about this little description, which could be used on the project homepage (drupal.org/project/formfilter):
"

  • Formfilter allows Admins (and Users with 'administer form filters' permission) to hide - for each specific Form - selected input fields from Users who don't have the 'view forms without filtering' permission.
  • Admins will see, at the foot of every input form (for example the Node Edit tab), a 'Filter This Form' link. This shows the whole form with a Formfilter checkbox adjacent to each field (eg 'Hide Title: [x]'). Selecting a checkbox will hide that field from unauthorised Users, whilst allowing all the unselected fields to be used normally. Because Admins always see the unfiltered version of each form, there is also a link to 'Preview a filtered version of this form' which appears once some formfiltering has been applied.

"

(Nb - the Preview link should (in a perfect world) disappear when no filters are active, ie if all the 'Hide ...' checkboxes are unselected.)

... I still find the 'Submit' method for the filter checkbox settings rather un-intuitive. For example, I'm testing it on a node-create form, which requires a node Title at least, so if I use the Preview or Submit buttons (without entering a title because I don't actually want to create a node), I get stalled and distracted by the formcheck error message. The filters get applied OK, but the UI/workflow becomes confusing.

  1. If a Form has a 'Submit' or 'Save Configuration' button, using Formfilter to hide the button would render the Form entirely useless! ... so this particular type=submit field should always be avoided by Formfilter. (Nb However, being able to hide the 'Preview' submit button, and Required fields which have default values set, are quite useful ...)
  2. May I suggest that Formfilter append it's own 'Submit' or 'Apply Formfilters' link or button to the Formfilter-editing version of the Form, which only submits the Hide (checkbox) values, and (most importantly) returns the Formfiltered Preview so you can see what you've just done.

Does that make sense ?

#6

JohnG - April 17, 2007 - 14:50

@ #5.2 : Hang on ... even simpler solution:
Because the Form's Formfilter-edit page settings are applied when a checkbox is altered (we don't need to submit the changes), all we need to do is add the Preview a filtered version of this form link to the bottom of that page ... just to give Admins somewhere to go next ...?

#7

nedjo - April 17, 2007 - 14:50

Thanks a lot for the suggested text, I've updated the module description.

Your other suggestions are good. I'll have to think a bit about how I could implement them, and I'm busy with other things, but if I find time I'll try to make improvements. Of course, if anyone wants to submit patches that would be great.

#8

JohnG - April 17, 2007 - 22:22
Status:active» needs work

@ #5 : add the Preview a filtered version of this form link to the bottom of the Form's Formfilter-edit page. This seems easy enough but unfortunately when the link is clicked, it doesn't 'save' the changes; getting the link to behave as a Submit button is apparently necessary :P ... I've been staring at this for hours and I just don't understand enough code to see how to do this ... ?

The attached patch simply reproduces the Preview link generator in the 'edit' bit of function formfilter_form_alter. Part way there at least ;)

AttachmentSize
formfilter_0_1.patch 1006 bytes
 
 

Drupal is a registered trademark of Dries Buytaert.