deal it in the app itself (SQLFORM without automatic dbio, plus 
onvalidation) or with DAL callbacks...

On Saturday, November 16, 2013 9:57:08 PM UTC+1, mweissen wrote:
>
> Let's say I have a table like
>
> db.define_table("phonebook",
>     Field("phonenumber", represent=lambda v,r: "secret" if r.secret==True 
> else v),
>     Field("secret","boolean", default=False)
> )
>
> The first part is simple: if I want to hide a phonenumber, I have to check 
> the secret field and instead of the phonenumber the word "secret" is 
> visible.
>
> Now the second part: a phone number, which has been made secret, should 
> not be visible again. It should be possible to enter a new phonenumberor to 
> clear the field, but the secret-flag should only be writable, if 
> phonenumber is empty.
>
> Field("secret", "boolean", writable=lambda v,r: (r.phonenumber=="") or 
> (v==False))
>
> would do the job, but writable cann't be a lambda function - right?
>
> Maybe I could use a second boolean field but it seems to become 
> complicated. Are there any ideas for a simple solution?
>
> Regards, Martin
>
>
>
>
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to