Hi,

On Aug 3, 11:21 am, Doug B <[EMAIL PROTECTED]> wrote:
> As far as I know a form submits to a single url via the action=?
> specifier.  That's just the way an html form works.  Each submit
> button that is part of the form is going to post to the action url in
> the form.  You can override with javascript, but that doesn't make
> much sense unless you're doing ajax or something.
>
> You CAN check to see which submit button was used in the view, and
> make logic decisions accordingly.  Just make sure you name your submit
> buttons and check which is in request.POST and make logic decisions
> from there.
>
> in template
> <input type="sumbit" name="button1" value="Don't click me">
> <input type="sumbit" name="button2" value="Click me">
>
> then in view
> if request.POST:
>     if request.POST.has_key('button1'):
>         do button 1 stuff
>     elif request.POST.has_key('button2'):
>         do button 2 stuff

thanks doug, this is what I did, but I am not comfortable with it.
those two button do different things, and if they're under one method
on the views it could be ugly, what if I have 4 or 5 submit buttons?

any other sugguestions?

thanks
james


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
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