form2js
form2js copied to clipboard
checkboxes should return JSON true/false
in the case of false (unchecked) it doesn't need to return anything as if(variable) will have the same behavior with null as with false. the 'false' case works. the 'true' case doesn't work.
will return
"exemption": {
"enabled": "true"
},
where as it should return
"exemption": {
"enabled": true
},
code fix: case 'checkbox': if (fieldNode.checked){ if(fieldNode.value === "true"){return true;} return fieldNode.value; } break;
in function: function getFieldValue(fieldNode)
sorry, i'm still a git noob, so i didn't fork / pull-req
Fixed with 985a3f3214303e2c51d032590ec0b9fb15e51b63
I think that your code would be greatly simplified if it used jquery... pulling all of the objects with a name field is 1 line of code. some of the code i wrote for my js2form implementation could be used to simplify transforming field names into objects and putting values in them.
it's not a big deal for me, though, because i'm using templates for this type of stuff now.