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 [email protected].
To post to this group, send email to [email protected].
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/7b547f2e-3276-40fd-8f72-77c0d42508c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to