@Eric, see my gist at https://gist.github.com/mklauber/4011a7ea95b158bfcfbf . I've actually got a version of this working, though I'm still fixing bugs, most notably a tiddlywiki script crash if the destination tiddler doesn't exist. Once I've got enough of the bugs resolved with my own usage, I'll open a PR.
On Wednesday, November 4, 2015 at 4:05:05 PM UTC-5, Eric Shulman wrote: > > On Wednesday, November 4, 2015 at 10:15:07 AM UTC-8, Matthew Lauber wrote: >> >> I'd like to have a select widget that uses the multiple property of the >> base html select widget, and when selected, updates a list field with all >> the selected values. Is this something someone has seen/done before, or am >> I in new territory? >> > > The $select widget doesn't currently support the "multiple" property. > > To make it capable of handling multiple values, there are two functions in > $:/core/modules/widgets/select.js that need to be extended: > > * SelectWidget.prototype.handleChangeEvent() currently just assigns the > DOM element's .value attribute (the "current selection") to the target > tiddler field/index. To support multi-select, this function needs to > iterate over all the items in the DOM element's .options array and > concatenate all the selected items into a single space-separated, bracketed > list that it can then write into the target tiddler field/index. > > * SelectWidget.prototype.setSelectValue() currently just takes the stored > value from the tiddler field/index, and sets it into the DOM element's > .value attribute. To support multi-select, this function needs to split a > space-separated, bracketed value stored in the tiddler field/index into > separate items that can then be individually selected in the DOM element. > > Both of these enhancements would only be triggered when the "multiple" > attribute is used in the <$select> widget, so that the widget behavior > would be unchanged for all current uses, so this would be a 100% > backward-compatible improvement to the core functionality. > > -e > > -- You received this message because you are subscribed to the Google Groups "TiddlyWiki" group. To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+unsubscr...@googlegroups.com. To post to this group, send email to tiddlywiki@googlegroups.com. Visit this group at http://groups.google.com/group/tiddlywiki. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d102b46f-2976-4e59-a86e-4ab1852cc1f8%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.