freeform: Getting default field values for autocallable methods
Hi, When defining a form with attributes that are handled by freeform, the default values of the form are automatically filled in with the current values of the attributes. However, when using an autocallable method which takes parameters, there seems to be no way to supply default values for the fields. I'll elaborate a bit more on this by providing an example: Say that I want to show a form with the current values of a database record. Then, when the user submits the form, I want to update the record using the changed values that the user entered. It seems that using an autocallable is the correct way to do this. However, how do the original values from the database get to the form fields? Thanks, -- Gavrie.
On Thu, Jan 01, 2004 at 05:15:42PM +0200, Gavrie Philipson wrote:
Hi,
When defining a form with attributes that are handled by freeform, the default values of the form are automatically filled in with the current values of the attributes.
However, when using an autocallable method which takes parameters, there seems to be no way to supply default values for the fields.
fd = freeform.IFormDefaults(ctx.locate(IRequest).getSession()) fd.setDefault('setData.pageData', 'default text') where setData is the autocallable's name, and pageData is the parameter. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://radix.twistedmatrix.com
Chris Armstrong wrote:
On Thu, Jan 01, 2004 at 05:15:42PM +0200, Gavrie Philipson wrote: ...
However, when using an autocallable method which takes parameters, there seems to be no way to supply default values for the fields.
fd = freeform.IFormDefaults(ctx.locate(IRequest).getSession()) fd.setDefault('setData.pageData', 'default text')
where setData is the autocallable's name, and pageData is the parameter.
This looks like what I need. Thanks, -- Gavrie.
participants (2)
-
Chris Armstrong
-
Gavrie Philipson