On 18 January 2013 15:05, Sverre <sverreodeg...@gmail.com> wrote: > I have a contact table that includes our employees too. To make a > difference I have a cclass field to make the difference. When I want to > create an employee the user should not have a choice to set the cclass > field, but when he is creating a customer or supplier. > > So I tried in SQLFORM.grid the oncreate callback with this function: > > def setEmployeeClass(form): > form.vars.cclass = 2 > > But this doesn't work. Has someone a tip? >
Try using 'default = 2' in your model and writable = False in your form definition. Regards Johann -- Because experiencing your loyal love is better than life itself, my lips will praise you. (Psalm 63:3) --