I believe you can do the following:
if request.method == "POST":
form = MyForm(request.POST)
c = form.data["a"] + form.data["b"]
form.fields["c"].initial = c
return render_to_response(template_name , {"form": form})
assuming the initial attribute makes sense for the 'c' field. You can
can dynamically reset field attributes (and even dynamically add
fields) to a form.
conrad
On Aug 29, 5:50 am, Karen Tracey <[email protected]> wrote:
> 2009/8/29 hao he <[email protected]>
>
> > thanks for your reply。
>
> > yes,i want to display the form again with some field being modified.
>
> > how to set the new value to a field of fhe old form to render ?
>
> > for example :
> > in site signup case.
> > when there are some errors, we hope to display the signup again ,but the
> > password field would been cleared up。
> > how to clear it
>
> For the particular case of a password that you want the user to re-enter
> upon form re-submission, use the render_value argument to the PasswordInput
> widget:
>
> http://docs.djangoproject.com/en/dev/ref/forms/widgets/#django.forms....
>
> It isn't clear to me if you have a more general requirement than that?
> Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" 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/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---