Fix parsing values of option elements in forms (#162)
* Fix a bug where the value of <option> would not get sent if falsy According to the spec, the value attribute should be sent if it exists, even if it's falsy. * Don't send an <option> tag if it's disabled, even if it's selected
This commit was merged in pull request #162.
This commit is contained in:
@@ -67,8 +67,8 @@ function parseFormElements(el) {
|
||||
|
||||
for (var i = 0; i < element.options.length; i++) {
|
||||
opt = element.options[i]
|
||||
if (opt.selected) {
|
||||
values.push(opt.value || opt.text)
|
||||
if (opt.selected && !opt.disabled) {
|
||||
values.push(opt.hasAttribute("value") ? opt.value : opt.text)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user