blikblum/tinybind

Uncaught TypeError: el.options.forEach is not a function

Closed this issue · 2 comments

I added a select+multiple to my html form and bound it. but when you select the options in the list (in the browser) I get a "Uncaught TypeError: el.options.forEach is not a function error." it's around line 396-ish in the dist/* file.

<select name="mselect" multiple="multiple" class="form-control">
<!-- tinybind: each-row -->
<option value="1">jam</option>
<option value="2">cookie</option>
<option value="3">cat</option>
<option value="4">dog</option>
<option value="5">cake</option>
<option value="6">orange</option>
<option value="11">place holder</option>
</select>

    } else if (el.type === 'select-multiple') {
      el.options.forEach(function (option) {

Fixed it with a "old fashion" loop around line 395 in the dist/*.js file

for (var i = 0; i < el.options.length; i++) {
	if (el.options.item(i).selected) {
		results.push(el.options.item(i).value);
	}
}

Fixed in master