Malcolm,
I think I'm finally starting to get somewhere with this.  I assigned
my hidden field the initial 0 value

seen_updates = forms.IntegerField(widget=forms.HiddenInput, initial=0)

I was thinking that I could just do the following
'request['seen_updates'] = '1'' in my view and just resend
ContactForm(request.POST).  However, I guess I can't assign a value to
a POST element.  So does that mean I need to create a data field that
populates my entire form again

data = {'seen_updates': 1'',
...         'b_name': request['b_name'],
...         'b_address': request['b_address'],
...         'b_city': request['b_city']
             etc....}
f = ContactForm(data)
return render_to_response('checkout_form.htm', {'fo': f})

Thanks



On Oct 14, 7:56 pm, Malcolm Tredinnick <[EMAIL PROTECTED]>
wrote:
> On Sun, 2007-10-14 at 17:35 -0700, Greg wrote:
> > Malcolm,
> > I've created a new form field:
>
> > seen_updates = forms.IntegerField(widget=forms.HiddenInput)
>
> > I've added the form field to my checkout page:
>
> > <form method="post" action="/plush/cart/checkout/">
> >       {{ fo.seen_updates }}
>
> > How do I assign it a value of 0 for when the sales tax has not been
> > shown, and a 1 for when the sales tax message has been shown?
>
> You spend a bit of time reading the documentation, since a lot of these
> questions are answered there. In this case, if you're wondering how to
> assign an initial value to a field when rendering the form, you look in
> the newforms documentation and you see the section called "core field
> arguments" with a subheading of
> "initial" 
> (http://www.djangoproject.com/documentation/newforms/#core-field-argum...). 
> Looks like exactly what you want.
>
> Since the hidden value will be zero unless you have just processed their
> first submission, you can set it to zero initially and then, in the view
> that processes the form POST, set it to 1 before writing out the form
> the second time around.
>
> Spend a few minutes experimenting with this stuff. It's fairly well
> documented and the source isn't that hard to understand (and is well
> commented) if you need to look in there.
>
> Regards,
> Malcolm


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to