Closed (fixed)
Project:
Webform
Version:
5.x-2.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
5 Aug 2008 at 17:22 UTC
Updated:
11 Nov 2008 at 00:23 UTC
Jump to comment: Most recent file
Comments
Comment #1
deviantintegral commentedComment #2
deviantintegral commentedI had a thought of a different way to do it; this is easier for users, but could break anyone who happens to use 'group' as a key:
group|Group 1
key|option
key|option
group|Group 2
key|option
key|option
To unset the grouping, to have selectable items at the root, you use.
group|
Any thoughts as two these two approaches would be appreciated.
Comment #3
quicksketchThis looks pretty good. I think I prefer the first approach more than the second, even though it results in more redundancy. Do you have a particular leniency towards one way or the other?
Comment #4
deviantintegral commentedThe main reason for the second version was being able to specify options without keys:
group|Group 1
option
option
group|Group 2
etc...
My main concern is making it as clear as possible for non-technical users, and the 2nd way seems to be simpler to explain, and visually matches what will be rendered.
--Andrew
Comment #5
quicksketchAh, I see that makes a lot of sense. Do you think we could possibly devise another format instead of group|Name for creating groups? It doesn't seem like the word "group" is really necessary at all. Maybe something like this?
The
<word>syntax is relatively common in Drupal for special meanings e.g.<front>or<hidden>. Any user wanting to actually include brackets would need to do something like this:So all of those should render with the brackets in place, only a single line with brackets and no pipe would be considered a group. What do you think?
Comment #6
deviantintegral commentedI like the brackets. I'll start hacking and will post a patch soon.
--Andrew
Comment #7
deviantintegral commentedHere's a version which uses
<Group>syntax. Unfortunately, the only place brackets are allowed is for group names; in every other place, they are filtered for XSS in _webform_filter_values(). All of the calls could be replaced with ones which don't filter for XSS, but filtering seems like a good idea to me where we can. I don't think anything is exposed by not filtering the group tag, and I wasn't able to get any suspicious situations as we watch for the closing bracket on the preg_match.This also breaks the array flatten out into it's own function.
--Andrew
Comment #8
quicksketchAh, well that's nice in a way. That means no one is currently using brackets because they get stripped out anyway :)
I'll review when I get a minute. Thanks for your patches!
Comment #9
quicksketchI rerolled for the latest CVS version, tidied up a little bit by consolidating _webform_flatten_options() into _webform_select_options(). I added a SimpleTest for this new feature also. I opened #324028: Add help text for using Optgroups in Select list after noticing that there's absolutely no description on how to actually use this feature outside of the inline PHP code.
Comment #10
deviantintegral commentedAwesome, thanks!
--Andrew
Comment #11
Chris CharltonThis is a feature I was thinking about coding up. Great to see OptGroups coming.
Comment #12
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.