0

I'm using Grails 3.3.9 with Fields plugin . This plugin calls the fieldValue tag on numbers at line 862 here. FormFieldsTagLib.groovy . And for some reason this fieldValue tag is formatting numbers with a comma, even when the default format for the en_US locale is '0', which shoudln't be adding a comma. Is there a config to stop Grails from adding a comma when the fieldValue tag is invoked? Right now if the bean has an Integer property with a value of 2019, it gets rendered as 2,019.

To recreate, you can just do grails create-app myapp and then create a domain class with an integer property. Enable scaffolding, save a record and fetch it back. You will see it has comma in it.

Suneel
  • 817
  • 3
  • 10
  • 23

1 Answers1

0

I found the reason behind the commas by debugging through the code in ValidationTaglib.groovy . It is invoking asText method on a PropertyEditor as shown here: ValidationTagLib . Grails registers property editors here. So to fix it, you'll have to define your own Editor for Integer. You'll have to define your own PropertyEditorRegistrar to register the custom Editor, then declare it as a Spring bean as defined here.

Suneel
  • 817
  • 3
  • 10
  • 23