>> Just define a MultipleHiddenField-widget, which has an attribute "hidden" 
>> that
>> is True.
> 
> You mean define from scratch ?

Er, yes. Like this:

class MultipleHiddenFields(Widget):
     params = ['hidden']
     hidden = True

     template = """
<input py:for="key, v in value.items()" type='hidden' value="${v}" 
name="${key}"/>
"""

Not exactly rocket science in my book.

>> This widget then will be rendered by the form in the hidden-fields.
>>
>> This widget could for example expect it's value to be a dictionary, from 
>> which
>> it's key/value pairs it will render a hidden-input tag.
> 
> using jsonify for example ?
> 
>> Easy as cake...
>>
> 
> Heuu, I'm not pastry chef
> 
>> And you can set the value for that either on rendering time, via
>>
>> ${form.display(dict=(context_fields=context_fields))}
>>
>> where context_fields is that dict of yours, or if you have to, you could
>> create a property in the widget instead, which can of course have a callable
>> passed.
>>
>> This callable could extract that context information, from e.g.
>> cherrypy.request..
> 
> Yes I this could match my need, but...
>> Get creative!! It's all there :)
> 
> ... Creative ? What about my idea to redefine the Form class ?
> It's a lot esyer to use, just need to mix form data and contextual
> data together.

I don't think it is easier to use, because the multiple hidden fields 
widget can be used in any form, whereas your idea requires every form to 
be aware of context.

Diez

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to