Closed (fixed)
Project:
Webform
Version:
8.x-5.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Reporter:
Created:
27 Mar 2017 at 16:00 UTC
Updated:
18 Apr 2017 at 11:45 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
jrockowitz commented@stella Adding this element makes complete sense to me.
Besides tests, we should consider....
Notes.
Comment #3
stella commentedI think Radios would be harder to achieve as you can only select 1 radio button normally. So clicking through an expanding set of child terms which are all part of one radios set, wouldn't be good ux, no?
Though you probably want to be able to force them to click through one path and only select one child term at the very end (and not the entire tree). Maybe the cshs module approach to that is better? it's a drop-down which spawns a secondary drop-down for child terms which in turn spawns another for grandchildren, etc. And if you want to allow more than one term to be selected you click 'add more' to get another set.
As for the scrollable thing - as long as it's an optional feature, i'm ok with that.
Comment #4
jrockowitz commentedI think creating a WebformTermBase class is the key task and creating a WebformTermRadios element can be handled in a new ticket.
Comment #5
jrockowitz commented@stella I am going to do a little work on the patch.
Comment #9
jrockowitz commented@stella I added support for the #scroll property and set up a WebformTermReference trait. I ran into some "out of sync" exported configuration so the attached patch is updating all exported config.
Below is a screenshot of the #scroll adding scrolling to term checkboxes.
Right now, I can't see supporting the custom #states hide/show logic but below is your code moved into a custom hook, that you can use to maintain this functionality for your client.
I am going to write some tests and commit this improvement.
In the long term, it would be really cool if we could support something like https://www.jstree.com/ for selecting hierarchical taxonomy terms.
Comment #10
jrockowitz commented@stella I also think it should be possible to add support to the webform module for the cshs module which includes a dedicated form element.
Comment #13
jrockowitz commentedComment #15
jrockowitz commentedComment #17
stella commentedThe idea behind the states thing is to reduce the length of checkboxes visible at any one point, so the user only sees the ones relevant to them. They have to click on a term to see its children, and then can drill down to the child term they want. My requirement was they had to select each parent along the way to get to the final term they wanted to select.
The taxonomy I have is going to grow quite large, 100 or so terms, so the client only wanted top level ones visible, and then clicked down through to refine the categorisation of the event that was being submitted on the form. They have about 8 top level terms, and the rest are more specialised as you drill down.
Comment #18
jrockowitz commented@stella That requirement makes sense. I remember a similar feature being included in the hierarchical select module. I think the UX would need to more refined before being included in the Webform core module. For example, any term with sub-terms should have an open/close indicator, like an arrow. Hopefully, the webform module can just integrate with one of the available hierarchical selection module.
For now, the scrolling behavior will allow for 100+ terms to be displayed.
BTW, this custom hide/show code could be moved to a recipe.
Comment #20
jrockowitz commented