Thanks all, I going to use a custom validator then.

Best Regards,
Santiago

On Mon, Jul 2, 2012 at 3:00 PM, [email protected] <[email protected]
> wrote:

> Remember "requires" property is not used when you just insert(), update()
> or update_record().
>
> So, in Web2py you don't have anything like a db trigger. You could do it
> using a custom validator like CLEANUP() and using validate_and_insert() or
> validate_and_update() in substitution of regular insert() or update().
>
>
>
>
> On 07/02/2012 10:08 AM, Santiago wrote:
>
>> Hello,
>>
>> I have a field defined as below :
>>
>> Field('id_indra', length=5, label=T('ID Indra'), notnull=False,
>> requires=[REQUIRED, MAX_5, IS_MATCH(r'^[a-zA-Z0-9]{5}$')]**)
>>
>> Is it is possible to intercept all inserts / updates over this field and
>> do a zfill() before the accion takes place? So, if the field is '5',
>> they it would be completed with zeroes with a result of '00005' before
>> insert / update.
>>
>> Thanks in advance
>>
>> Regards,
>> Santiago
>>
>
>

Reply via email to