Closed BiserStoilov closed 6 years ago
Thanks @BiserStoilov. Attr.nodeValue
is deprecated in favour of Attr.value
, but otherwise I think you are right.
Feel free to submit a PR (ideally with tests) to implement this, if you like, otherwise this will get looked at at some point for a future release.
Unfortunately this solution will not work with Select. Just tested it.
@borkor this work for me with form with any element:
var elementType; if (element.tagName.toLowerCase() === "input") { if (element.type === "text") { elementType = "input"; } if (element.type === "checkbox") { elementType = "checkbox"; } if (element.type === "radio") { elementType = "radio"; } } if (element.tagName.toLowerCase() === "select") { elementType = "select"; } if ((elementType !== "checkbox" && elementType !== "radio") || element.checked) { paramObject.push({ name: encodeURIComponent(element.name), value: encodeURIComponent(element.value) }) }
Please, test...
Best regards
@BiserStoilov Looks good. Tested it :+1:
@BiserStoilov Can you make a pull request?
Thanks for your PR, @BiserStoilov. In fixing #126, however, I have also resolved this issue in my PR. Sorry about that!
Perhaps you could check out the branch and test to see if this resolves your original issue?
Fixed in #129
Hi,
i found small bug when pjax submit form with radio and checkbox.
This code in attach-form.js
if ((element.attributes.type !== "checkbox" && element.attributes.type !== "radio") || element.checked) { paramObject.push({name: encodeURIComponent(element.name), value: encodeURIComponent(element.value)}) }
maybe must replace with this
if ((element.attributes.type.nodeValue !== "checkbox" && element.attributes.type.nodeValue !== "radio") || element.checked) { paramObject.push({ name: encodeURIComponent(element.name), value: encodeURIComponent(element.value) }) }
Best regards