Now I see what you are trying to do. I do not consider this a bug. At this point this is the intended behavior. You want conditional computed fields depending on user input. If a value is provided use it, if one is not provided then compute it. That is not what compute fields were designed for. What you ask can be done but would break backward compatibility because it would require running the compute callback even if there is a value provided for the computed field and let the callback decide whether to override the provided value. For some an empty value "" is an acceptable value and for some it should trigger a computation. For me a field has a compute attribute the field is NOT editable in forms, it is only readable.
On Tuesday, 11 September 2012 07:17:28 UTC-5, 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. > > --

