please try :
represent = lambda payment_amount, field: format(payment_amount, ",.2f")
best regards,
stifan
--
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)
---
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
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
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 in
4 matches
Mail list logo