Thank you for the answer! On Monday, April 7, 2014 11:34:33 PM UTC+2, 黄祥 wrote: > > 1) when the form is accessed some of the fields should already contain a >> hint which is not necessarily the default value of the field >> > > i think you can achieve it using default > e.g. > table.registration_date.default = request.now >
I'm not sure I can use *default* for my purpose. The hint should depend on which of the forms I'm using to fill the table row data. If the *default *value is a function how can I influence it's behaviour from the form? > 2) the user should select a value from a drop-down list and some other >> fields should be filled with other hints (the data used for giving these >> hints should come from another table) >> > > you can achieve it when you have the relation on your table and set the > IS_IN_DB() validation for the field that reference to another table > e.g. > db.define_table('branch', > Field('address', 'text'), > format = '%(address)s') > > db.define_table('header', > Field('branch', 'reference branch'), > format = '%(branch)s') > > db.header.branch.requires = IS_IN_DB(db, db.branch.id, '%(address)s') > Maybe I was not clear with my explanation. In my app I've already used references, but what I want here is different. Let's say I have two tables: db.define_table('ice_cream_orders', Field('flavour', 'text'), Field('quantity', 'double')) db.define_table('hints', Field('client', 'text'), Field('flavour_hint','text')) Assume I'm creating a form to make insertions in the first table. In the form I want a drop-down list containing all the possible values of "client" from the second form. If the user selects a client, the corresponding value of "flavour_hint" should appear as a hint for the field "flavour". The user should be able to modify the value of "flavour" also after the hint is given. Carlo -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.