Re: Form Validation for GET Request

2008-06-14 Thread [EMAIL PROTECTED]
I always use if(len(request.GET)>0): form=TestForm(request.GET) if(form.is_valid()): #process form else: form=Testform() --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to

Re: Form Validation for GET Request

2008-06-13 Thread Bartek Gniado
Maybe because you actually have to pass `action`? ;) Pass it through your form. Maybe my use of 'action' confused you with the 's action property. Not what I meant, sorry. I didn't realize you had an actual form (Wait, why do you .. Ok, beyond the point) but in this case you can just check for

Re: Form Validation for GET Request

2008-06-13 Thread ichbindev
This is what my template looks like: {{ form.as_table }} This is what my view looks like: ... myform = MyForm() if request.method=="GET": myform = MyForm(request.GET) if request.GET.get('action') == True: if myform.is_valid(): ... ... return render_to_response

Re: Form Validation for GET Request

2008-06-13 Thread Bartek Gniado
If errors are showing when you first load the page then you need to check that the user has actually completed an action before validating the form. In this case, doing something like if request.GET.get('action') == True: # your form validation here In your links back to the system, simply

Re: Form Validation for GET Request

2008-06-13 Thread ichbindev
The problem is when I use myform = MyForm(request.GET) if myform.is_valid(): ... Any fields which are required have their error message activated on first visit to page. Also, any 'initial' value that I put in the forms is not shown. --~--~-~--~~~---~--~~ You

Re: Form Validation for GET Request

2008-06-13 Thread Russell Keith-Magee
On Sat, Jun 14, 2008 at 9:05 AM, ichbindev <[EMAIL PROTECTED]> wrote: > > However, form.is_valid() is for POST only. Is there an is_valid() kind > of thing for forms where method is GET so that data may be validated? I don't know what gave you the idea that is_valid() is just for POST data.

Form Validation for GET Request

2008-06-13 Thread ichbindev
I am writing a report page where users get to enter data in a form and based on it search results are provided. There are at least four fields in the form and all are used in searching. We are not making any changes to data, we should use GET instead of POST as form method. Since this input is