⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

maxlength of decimal fields



johnvanham
  • profile picture
  • Member

Posted 13 December 2012 - 20:03 PM

This should be a simple one to fix hopefully...?

Anyway if a field in SQL is defined as Decimal (5,2) then GroceryCRUD sets the maxlength to '5,2'...

E.g.

<input id="field-price_single_eur" name="price_single_eur" type="text" value="120.00" class="numeric" maxlength="5,2">

It would be nice if it set it to 5+2+1 (for the decimal place) e.g. maxlength="8"

Or am I doing it wrong? :)

Thanks!

web-johnny
  • profile picture
  • Administrator
  • 1,166 posts

Posted 15 December 2012 - 18:09 PM

Actually this is a very good idea [member='johnvanham']. I like it :) . I just added it to github https://github.com/scoumbourdis/grocery-crud/issues/141

Thanks
Johnny

BalaPerdida
  • profile picture
  • Member

Posted 14 April 2013 - 18:57 PM

I have the very same problem.


bzuro
  • profile picture
  • Member

Posted 18 September 2013 - 01:05 AM

The correct way would be 5+1, because the 2 decimal places are incorporated in the 5. In other words 5 is the total number of digits without the decimal character.

I have send you a pull request on github for the fix.