Skip to main content
eric_estes
Level 2
Dec 9, 2015 5:38 PM UTC
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
Level 9
Dec 10, 2015 5:31 AM UTC

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

smacdonald2008
Level 10
Dec 9, 2015 8:19 PM UTC

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
Level 8
Dec 9, 2015 9:22 PM UTC
eric_estes
Level 2
Dec 9, 2015 9:50 PM UTC

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
smacdonald2008
Level 10
Dec 9, 2015 10:20 PM UTC
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
kautuk_sahni
kautuk_sahniAccepted solution
Level 9
Dec 10, 2015 5:31 AM UTC

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