On Nov 13, 11:58 pm, Eric <[EMAIL PROTECTED]> wrote:
> Hi,
> Using TG 1.9.7a4, TG rookie. After submitting a form, I redirect back
> to the same page to allow another entry.
>
> raise redirect("new_ai")
>
> There are SingleSelectField widgets whose values could change as a
> result of the previous submission. What is the best way to force the
> SingleSelectFields to reload?
>
> def new_ai(self, **kw):
> """Form to add new record"""
> pylons.c.form = create_aitracker_form
> return dict(modelname='Action Item')
>
> The TableForm class for the page has these lines:
>
> people = DBSession.query(Person.id, Person.fullname).order_by
> (Person.fullname).all()
> assigned_by_id = SingleSelectField("Person_by", options = people,
> default = 0, label_text = "Assigned by")
>
> Thanks,
> Eric
Hi all,
Update with what I tried (this all started with the tutorial code):
Create form...
create_aitracker_form = AITrackerForm("create_aitracker_form",
action='create_ai')
Then in the function that is called when the form is submitted I put:
global create_aitracker_form
and as a test I put create_aitracker_form = "" right before the
redirect
As expected, following the redirect I got an error, #TypeError: 'str'
object is not callable
However, when I changed the above create_aitracker_form line to:
create_aitracker_form = AITrackerForm("create_aitracker_form",
action='create_ai')
I get the original form without the updated single selects? I put
debug statements in the TableForm class and they are only executed
once when the page is first setup, not again when I update
create_aitracker_form. At this point I should admit that besides
being new to TG2 I am pretty new to Python so...
Thanks,
Eric
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---