cburschka / cadence

A strophe.js-powered XMPP web client for chatrooms.
6 stars 2 forks source link

list-multi fields get a bad default value #427

Closed cburschka closed 7 years ago

cburschka commented 7 years ago

The list-multi field constructor in ui.dataForm uses the list-single constructor, and lets it handle the field's default values. That only works if there is at most one default value.

cburschka commented 7 years ago

It turns out that jQuery really doesn't like setting the selected attribute of options.

  1. Options aren't selected unless the attribute is set on node creation (not on insertion)
  2. Appending a selected option to a select deselects all other options unless the select element is already set to multiple.

As a result, it is better to combine list-single and list-multi constructors in a single function that does both.