On 05.03.12 08:13, Robert Forkel wrote:
> Hi,
> i have the following Problem: I want to add fields to a form at
> arbitrary positions after the form instance has been initialized (this
> is intended as a configuration mechanism - a default form can be
> manipulated by custom packages).
> I didn't find a public API method to do this, but came up with the
> following:
> 
> myform = Form(MySchema(), buttons=[])
> 
> node = SchemaNode(String(), name='new', description='well, new')
> 
> myform.schema.add(node)
> myform.children.insert(1, Field(node, renderer=myform.renderer,
> counter=myform.counter,
> resource_registry=myform.default_resource_registry))
> 
> obviously, that's a bit of a hack, but wouldn't look too bad if placed
> in a form method "insert_node" or something the like. How fragile
> would this be, i.e. how likely is it, the API it relies on will
> change?
> regards,
> robert
> 

Check out the following discussion [1] to see if it's of help.

Regards

[1] https://groups.google.com/forum/#!topic/pylons-discuss/55FXAMkde4w

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to