Skip to content

checkboxes should return JSON true/false #15

Open
boxxxie opened this Issue Oct 11, 2011 · 4 comments

2 participants

@boxxxie
boxxxie commented Oct 11, 2011

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
},
@boxxxie
boxxxie commented Oct 11, 2011

code fix:
case 'checkbox':
if (fieldNode.checked){
if(fieldNode.value === "true"){return true;}
return fieldNode.value;
}
break;

in function: function getFieldValue(fieldNode)

@boxxxie boxxxie closed this Oct 11, 2011
@boxxxie
boxxxie commented Oct 11, 2011

sorry, i'm still a git noob, so i didn't fork / pull-req

@maxatwork maxatwork reopened this Oct 11, 2011
@maxatwork
Owner

Fixed with 985a3f3

@boxxxie
boxxxie commented Nov 15, 2011

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.