Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Value 0 of nested array not displayed and module can not be saved. #45

Closed
fallhunter opened this issue Sep 24, 2013 · 4 comments
Closed

Comments

@fallhunter
Copy link

When use [{type:Number}]

the value 0 will not be displayed in the input widget, I found
res.write('\n<input' + (this.value ? ' value="' + escapeHTMLComponent(this.value) + '"' : '') );
at line 60, widgets.js. where this.value will treat 0 as no value and display nothing.

And,
when you try to save an array [{type:Number}], for the 0 was not fill in the input field,
the form will post nothing to the server, and make exception in the server like:

Cast to number failed for value "NaN,NaN,NaN,NaN,NaN" at path "xxxx"

@alonronin
Copy link
Contributor

you should use [Number] or [{type:Number}]
it is case sensitive.

@fallhunter
Copy link
Author

Yes, in my code it's "type", just typo in the issue. please look into this.

@refack
Copy link
Member

refack commented Sep 25, 2013

There were three issues here, two where solved.

  • Not considering 0 as a valid value, hence not rendering it
  • Not showing correct error message for failing to cast empty value into a number
  • Erroneously turing null in NaN, thus failing the cast.

@refack refack reopened this Sep 25, 2013
@refack
Copy link
Member

refack commented Nov 12, 2013

Fixed

@refack refack closed this as completed Nov 12, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants