Update attach-form.js

This commit is contained in:
Biser Stoilov
2018-02-17 20:27:42 +02:00
committed by GitHub
parent b351647313
commit df6cfda33f

View File

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