Decimal values in Numberfield? | Community
Skip to main content
eric_estes
Level 2
December 9, 2015
Solved

Decimal values in Numberfield?

I'm trying to use a Coral Numberfield, but it marks a decimal value as invalid and there doesn't seem to be any option to allow it. Is there something I'm missing?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
kautuk_sahni
kautuk_sahniAccepted solution
Employee
December 10, 2015

Hi 

You can use TypeHints for the same. Add a hidden field (xtype:hidden) with name = <numberField'sName>@TypeHint and value= Long (http://stackoverflow.com/questions/28467498/save-cq-component-field-value-as-long-instead-of-string).

Also please have at article mentioned by "Leeasling" :- http://blogs.adobe.com/livecycle/2011/12/beyond-string-typehint-to-rescue.html

I hope this would act as some help to you.

Thanks and Regards

Kautuk Sahni

Kautuk Sahni

5 replies

kautuk_sahni
kautuk_sahniAccepted solution
Employee
December 10, 2015

Hi 

You can use TypeHints for the same. Add a hidden field (xtype:hidden) with name = <numberField'sName>@TypeHint and value= Long (http://stackoverflow.com/questions/28467498/save-cq-component-field-value-as-long-instead-of-string).

Also please have at article mentioned by "Leeasling" :- http://blogs.adobe.com/livecycle/2011/12/beyond-string-typehint-to-rescue.html

I hope this would act as some help to you.

Thanks and Regards

Kautuk Sahni

Translate
Kautuk Sahni
smacdonald2008
Level 10
December 9, 2015
Have you tried to write a custom type that let's you use decimal values. I am thinking there may be a way to write custom script to solve this. 
Translate
eric_estes
Level 2
December 9, 2015

Yup, that's it. The old numberfield has a bunch of options but they don't seem to carry over to the new one.

Translate
Level 8
December 9, 2015
smacdonald2008
Level 10
December 9, 2015

This data type looks like the only number field:

https://docs.adobe.com/docs/en/aem/6-0/develop/ref/granite-ui/api/jcr_root/libs/granite/ui/components/foundation/form/numberfield/index.html

this is the one you are using - correct?

Translate