I'll use something like numeraljs (http://numeraljs.com/) to deal with this on the browser-client, so that the server side data is just numbers with no formatting.

________________________________________
Kiran Subbaraman
http://subbaraman.wordpress.com/about/

On Wed, 22-04-2015 12:49 PM, Andy W wrote:
Hi Annet

I appreciate the quick response.
I changed the table definition to include:

|
Field('payment_amount',type='decimal(10,2)',
          label=T('Payment Amount'),
          requires=IS_DECIMAL_IN_RANGE(-1e100,1e100,dot=".")),

|


Entering an amount of say '1,000' now traps the error at the form
validation stage, which is much better. However, it would be better still
if the '1,000' could be changed to '1000' in the background - any ideas?

Thanks for the help,

Andy

On Wednesday, April 22, 2015 at 10:18:18 AM UTC+4, Annet wrote:

    Hi Andy,

    Use the IS_DECIMAL_IN_RANGE() validator

    db.receipt.payment_amount.requires=IS_DECIMAL_IN_RANGE(-1e100,
    1e100, dot=".")


    From the web2py book:

    The minimum and maximum limits can be None, meaning no lower or
    upper limit, respectively.

    The |dot| argument is optional and allows you to internationalize
    the symbol used to separate the decimals.


    Kind regards,

    Annet

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to