Support radio, checkbox and select in form #125

Closed
BiserStoilov wants to merge 4 commits from master into master

View File

@@ -50,8 +50,23 @@ var formAction = function(el, event) {
// jscs:disable disallowImplicitTypeConversion
if (!!element.name && element.attributes !== undefined && element.tagName.toLowerCase() !== "button") {
// jscs:enable disallowImplicitTypeConversion
if ((element.attributes.type !== "checkbox" && element.attributes.type !== "radio") || element.checked) {
paramObject.push({name: encodeURIComponent(element.name), value: encodeURIComponent(element.value)})
var elementType = "undef"
if (element.tagName.toLowerCase() === "input") {
if (element.type === "checkbox") {
elementType = "checkbox"
}
else if (element.type === "radio") {
elementType = "radio"
}
}
else if (element.tagName.toLowerCase() === "select") {
elementType = "select"
}
if ((elementType !== "checkbox" && elementType !== "radio") || element.checked) {
paramObject.push({
name: encodeURIComponent(element.name),
value: encodeURIComponent(element.value)
})
}
}
}