Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Number Field With Decimal values

Avatar

Level 2

Hi I am creating a dialog with multifield which have 2 number fields . Those number fields are latitude and longitude so I want that only numbers with decimal can be entered into the field, but it is not allowing me to enter the decimal values. I have gone through the link which said to use @TypeHint but seems it is only used for saving the data in the particular format and not entering the data.

Can anyone please point if there is any OOTB number field which accepts decimal also? Any pointers will be highly appreciated.

My aem version is 6.4.

Thanks

1 Accepted Solution

Avatar

Correct answer by
Level 10

The above link deals with Classic UI data types - xtype.

For Granite types - I am checking with the touch ui team. [UPDATE]

Team replied:

Yes there is no mentioned but you can use decimals in it.

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/granite-ui...

Also you can define step count in decimal

It step count is 0.2, it will update from 0.2 -> 0.4 -> 0.6…

Also - you can write you own AEM TOuch UI Resource type to achieve this functionality - something like:

jQuery Number Format Plugin

To learn how to create your own resource type - see this article that creates a resource type that defines a color picker:

Adobe Experience Manager Help | Creating a custom Experience Manager sling:resourceType for Touch UI

If you need a data type not defined in the Granite API, then build your own using JQuery - as shown above. Hope this helps...

View solution in original post

3 Replies

Avatar

Level 1

Dear Rohit,

Please find following community answer[1]

[1] Decimal values in Numberfield?

Regards,

Peter

Avatar

Correct answer by
Level 10

The above link deals with Classic UI data types - xtype.

For Granite types - I am checking with the touch ui team. [UPDATE]

Team replied:

Yes there is no mentioned but you can use decimals in it.

https://helpx.adobe.com/experience-manager/6-3/sites/developing/using/reference-materials/granite-ui...

Also you can define step count in decimal

It step count is 0.2, it will update from 0.2 -> 0.4 -> 0.6…

Also - you can write you own AEM TOuch UI Resource type to achieve this functionality - something like:

jQuery Number Format Plugin

To learn how to create your own resource type - see this article that creates a resource type that defines a color picker:

Adobe Experience Manager Help | Creating a custom Experience Manager sling:resourceType for Touch UI

If you need a data type not defined in the Granite API, then build your own using JQuery - as shown above. Hope this helps...

Avatar

Level 1

Hi, thank you for help. I used it in one component, it works but I have a problem at some values, which I do not understand.

If I try to enter 4,02 it shows me an validation error when I take 4,01 it is no problem.

1841401_pastedImage_3.png

<barValue
   jcr:primaryType="nt:unstructured"
   sling:resourceType="granite/ui/components/coral/foundation/form/numberfield"
   fieldLabel="GeneralBarValue"
   name="./barValue"
   value="1.1"
   typeHint="Decimal"
   step="0.001"

/>