I haven't followed this closely, but instead of specifying a "compute" 
attribute for the field, could you instead specify the "default" attribute 
as a function? In that case, the field will appear on forms -- if the user 
enters a value it will be used, and otherwise the default value will be 
computed. Of course, the record is not passed to the default function, so 
instead the default function would have to directly access request.vars to 
get the values of the other fields if needed (so this works with form 
inserts, but not other inserts).

Anthony

On Tuesday, September 11, 2012 8:17:28 AM UTC-4, Alan Etkin wrote:
>
> On Thursday, September 6, 2012 9:34:51 AM UTC-3, Massimo Di Pierro wrote:
>>
>> Please open a ticket and this will be easy to fix. 
>>
>>
> Opened the ticket:
>
> http://code.google.com/p/web2py/issues/detail?id=980
>
> Now it was closed with status fixed, but:
>
> -AFAIK, fileld.writable still has no effect in computed fields. You cannot 
> set a computed field as writable with crud so it shows the widget. You can 
> with SQLFORM (by using the fields argument), however, entering blank inputs 
> don't trigger the compute function server side.
> -There's no modification of SQLFORM to process empty form fields as 
> computable (in replacement of a previous or new record value)*
> -SQLFORM doesn't set computed fields as empty on form creation (I think 
> this should be the default behavior)*
>
> * Perhaps it would be necessary to add different checks by field type and 
> a standard way of detecting a blank input in each case.
>
> Of course, it's possible to show a given widget and do further record 
> processing in the controller without depending on the computed field 
> facility, but with this changes, it would save that extra code and give a 
> more clean and web2py like interface.
>
>

-- 



Reply via email to