Re: [web2py] Re: Validating SQLFORM decimal input field

2015-04-22 Thread 黄祥
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) ---

Re: [web2py] Re: Validating SQLFORM decimal input field

2015-04-22 Thread Kiran Subbaraman
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

[web2py] Re: Validating SQLFORM decimal input field

2015-04-22 Thread Andy W
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

[web2py] Re: Validating SQLFORM decimal input field

2015-04-21 Thread Annet
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