On Monday, March 5, 2012 7:22:05 AM UTC-5, Massimo Di Pierro wrote:
>
> Actually I think the problem is simply the JS validator. Try comment this
> line in static/js/web2py.js
>
> doc.on('keyup', 'input.double, input.decimal',
> function(){this.value=this.value.reverse().replace(/[^0-9\-\.,]|[\-](?=.)|[\.,](?=[0-9]*[\.,])/g,'').reverse();});
>
Note, the above Javascript only has an effect if the class of the input
element is "double". By default, SQLFORM adds a "double" class to input
elements for fields of type double, but you can override that by explicitly
specifying an alternate widget for the field (you could create a custom
widget, but I think a standard string widget should work in this case). So,
in your table definition:
db.define_table('mytable', Field('myfield', 'double',
widget=SQLFORM.widgets.string.widget))
That will give the input field a class of "string" instead of "double", so
the above Javascript will no longer affect it.
Anthony