Tutorial :Check for a hidden form variable in a view



Question:

I have several forms each having a hidden field that identifies this form...I want to check for this field in my view then based on the result determine which form will be processed. How should i go about this?


Solution:1

As long as the data is passed to the view in the post you should be able to grab it:

if request.method == "POST":      if "hidden_field_name" in request.POST:          ## do something  


Solution:2

You should be using Django Forms. They are very powerful and quite extensible.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »