Thanks Diez.
Would you be kind enough to give an example of submitting two forms
with one action?


On Oct 25, 4:48 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] schrieb:
>
>
>
>
>
> > Hello Everyone.
> > Maybe someone knows how to do it.
>
> > #My Controller file:
>
> > formFields = [widgets.SingleSelectField("special_program",
> > options=getSpecialPrograms(),
> > default='E',label="Special Program:"),
> > widgets.SingleSelectField("first_choice",
> >                                options=getChoices(),
> >                                default='',label="First Choice:")]
>
> > the_form = widgets.TableForm(
> >     name="add",
> >     formFields,
> >     values = "",
> >     submit_text="Save",
> >     action="save",
> >     )
>
> > @expose(template=".templates.form")
> > def index(self,tg_errors=None, tg_exceptions=None):
> >    return dict(form=the_form,action="/save")
>
> > # My template file:
>
> > ${form(action=action, method="POST")}
>
> > This works fine. I get the complete form in my template.
> > But what if instead i want to display only specific form fields in my
> > template.....something like:
>
> > ${form.special_program}
> > or
> > ${form.first_choice}
>
> There are several choices here.
>
> You could create two forms with the same action and the diffrences in
> the fields of which you return the right one, depending on your condition.
>
> Alternatively, you cane define a custom template for your form that is
> capable of rendering both versions. There are several ways to accomplish
> that. You could for example create an extra property on the conditional
> fields so that in the template, if the condition is not met, these are
> excluded.
>
> 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