0, true and false are not resolving correctly
guncebektas opened this issue · 8 comments
Boolean and Number give an error if I set them in the schema as 0 (Number), true (Boolean), false (Boolean). Setting them as strings ('0', 'true', 'false') solving the problem.
PS: I see it on the select element
I guess I know what's happening, it should be the .filter(Boolean)
on the select fields. I'll look into it soon, I'm a little busy with some server issues right now.
9b034b7 should solve the issue, let me know if it does or not.
It gives an exception
Exception in template helper: TypeError: field.slice is not a function at filterArrayFields (http://localhost:3000/packages/aldeed_autoform.js?hash=f1015d2cfe5a3911c24428719fb6ceb1e044fdc2:1331:24) at Array.filter (<anonymous>) at Object.autoFormFieldNames (http://localhost:3000/packages/aldeed_autoform.js?hash=f1015d2cfe5a3911c24428719fb6ceb1e044fdc2:1330:31) at http://localhost:3000/packages/blaze.js?hash=51f4a3bdae106610ee48d8eff291f3628713d847:3051:16 at http://localhost:3000/packages/blaze.js?hash=51f4a3bdae106610ee48d8eff291f3628713d847:1715:16 at http://localhost:3000/packages/blaze.js?hash=51f4a3bdae106610ee48d8eff291f3628713d847:3103:66 at Function.Template._withTemplateInstanceFunc (http://localhost:3000/packages/blaze.js?hash=51f4a3bdae106610ee48d8eff291f3628713d847:3769:14) at http://localhost:3000/packages/blaze.js?hash=51f4a3bdae106610ee48d8eff291f3628713d847:3102:27 at Spacebars.call (http://localhost:3000/packages/spacebars.js?hash=6f2be25813c793c0b363a6a91ebb029723f294ec:172:18) at Spacebars.mustacheImpl (http://localhost:3000/packages/spacebars.js?hash=6f2be25813c793c0b363a6a91ebb029723f294ec:106:25)
@guncebektas I'm trying to reproduce the exception you're getting, but no luck. Can you give me a little more context?
I will share my shema
@guncebektas sorry for my late reply, I'm checking your repo now.
Found the issues.
-
I was doing
this.value ? { value: this.value } : {}
and it was failing whenthis.value
was there but was a falsy value. I changed this to'value' in this ? ...
-
Apparently blaze does not render field attribute if the value of the attribute is
false
, so inafSelectOptionAtts
I'm now convertingfalse
to"false"
-
In your schema, you have a field of type
Boolean
, but you haveInteger
values in options
I made the necessary modifications to AutoForm and tested them with your repo. I'll close this and make a pull request on your repo.