Hi All,
I've a text field in a form:
Now how do i validate if the data entered is a number?Code:self._iFields = [(u'Height','text',u'3.8')]
Thanks![]()
Hi All,
I've a text field in a form:
Now how do i validate if the data entered is a number?Code:self._iFields = [(u'Height','text',u'3.8')]
Thanks![]()
In order to check if something is of a certain type, use the isinstance function. For example:
So when you save the data entered in your form, you can check if it is valid. I haven't tried it yet, but it should work and it shouldn't be too hard to do if you know exactly what your form is made of.Code:>>>p=1.45 >>>print isinstance(p, int) False >>>print isinstance(p, float) True