I'm pretty sure the documentation is there its just hard to understand
at first. You should just be able to pass it in as the value argument
to the display method. Say the hidden field is only nested in the
form at the highest level possible and is named myhiddenfield. In the
template you would have this:
${form.display(value=dict(myhiddenfield=5))}
Usually I pass the value dict as formData and the form in from the controller:
return dict(form=form, formData=dict(myhiddenfield=5))
and then just do this:
${form.display(value=formData)}
Note that a form itself is callable so this form.display() and this
form() are identical.
Is that a solution to your problem?
-Ian
On 7/2/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hi all,
> I want to use an hidden field in a form generated via simple form
> widgets.
>
> I managed to create the form (nothing troublesome here), but I fail to
> see the "right" way to provide a value for the hidden field. The
> places I feel would be right for doing so is either when passing the
> form object to the template for displaying or directly inside the
> template as an argument of the .display() method.
>
> I searched the API for a way of implementing both strategies, but I
> failed to find an answer so far. Any hint?
>
> What I'm doing at the moment is to dynamically create the form upon
> each request adding the HiddenField with a "default" value (using they
> keyword argument) which changes every time, but I feel like there
> should be a better way to do that ...
>
> Many thanks in advance,
> Cheers.
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---