Commit cb5aabdf authored by Rafael Ostertag's avatar Rafael Ostertag
Browse files

Allow spaces in value when selection <radio> and <select> tags.

parent d750eeec
...@@ -38,7 +38,7 @@ QfqNS.Element = QfqNS.Element || {}; ...@@ -38,7 +38,7 @@ QfqNS.Element = QfqNS.Element || {};
Radio.prototype.setValue = function (val) { Radio.prototype.setValue = function (val) {
this.$element.prop('checked', false); this.$element.prop('checked', false);
this.$element.filter('[value=' + val + "]").prop('checked', true); this.$element.filter('[value="' + val.replace(/"/g, "\\\"") + '"]').prop('checked', true);
}; };
Radio.prototype.getValue = function () { Radio.prototype.getValue = function () {
......
...@@ -77,7 +77,7 @@ QfqNS.Element = QfqNS.Element || {}; ...@@ -77,7 +77,7 @@ QfqNS.Element = QfqNS.Element || {};
// First, see if we find an <option> tag having an attribute 'value' matching val. If that doesn't work, // First, see if we find an <option> tag having an attribute 'value' matching val. If that doesn't work,
// fall back to comparing text content of <option> tags. // fall back to comparing text content of <option> tags.
var $selectionByValue = this.$element.find('option[value=' + val + ']'); var $selectionByValue = this.$element.find('option[value="' + val.replace(/"/g, "\\\"") + '"]');
if ($selectionByValue.length > 0) { if ($selectionByValue.length > 0) {
$selectionByValue.prop('selected', true); $selectionByValue.prop('selected', true);
} else { } else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment