Alex,
Thank you for the reply. After writing this question, I played around
more with django, and wrong some test cases to see what the behavior
was, and you're absolutely right, however I think you example is wrong?
Your name and value fields should be swapped? does the has_key()
function use the name field, not the value field. the value is the
text of the submit button. I hope I'm right only to show that I've
picked this up :-P.
Thanks again.
John
On Jan 6, 3:54 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
Hm, as far I understood your question you did not yet understood how to
make it in HTML? In HTML, every submit button will have name=""
parameter, so when this button is pressed, you can check for
the variable presense in your view. For example:
<form>
...
<input type="submit" name="save" value="Save">
<input type="submit" name="save" value="Cancel">
</form>
you your view:
if request.has_key('save'):
do_save_data(request.POST.copy())
elif request.has_key('cancel'):
return HttpResponseRedirect('somewhere')
else:
raise ValueError, 'invalid key pressed'
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---