On Feb 27, 2010, at 3:00 PM, Tiago Almeida wrote:

> Don't know why functions reset, reset_all are not called but they reference a 
> "form" variable which is not in scope? Do you have any global "form"?

The logic below can't work, for lots of reasons.

One is the one Tiago mentions. Another is that input elements do not have 
action attributes; forms do. There are ways to accomplish this kind of thing; 
most of them involve JavaScript.

This might be helpful (though it's not the way I'd do it): 
http://www.javascript-coder.com/html-form/html-form-submit.phtml

> 
> Regards,
> Tiago
> --
> 
> On Sat, Feb 27, 2010 at 10:15 PM, Tomas Pelka <tompe...@gmail.com> wrote:
> Hi all,
> 
> have some troubles with web form which have more than one button. It is
> obvious that one button (action connected with button) correspond with
> one function.
> 
> According manual this should work:
> controler
> ---------
> def index():
>  form = FORM('blah blah',
>        INPUT(_type='submit', _value='Apply'),
>        INPUT(_type='submit', _value='Reset', _action=URL(r=request,
> f='reset'),
>        INPUT(_type='submit', _value='Reset all', _action=URL(r=request,
> f='reset_all'))
>  if form.accepts(request.vars, session):
>        pass
>  elif form.errors:
>        response.flash = 'Error'
>  else:
>        pass
>  return dict(form=form)
> 
> 
> def reset():
>    if form.accepts(request.vars, formname=None):
>        response.flash = 'Reset'
>    elif form.errors:
>        response.flash = 'Error'
>    else:
>        pass
>    return dict()
> 
> 
> def reset_all():
>    if form.accepts(request.vars, formname=None):
>        response.flash = 'Resert all'
>    elif form.errors:
>        response.flash = 'Error'
>    else:
>        pass
>    return dict()
> 
> But action functions (reset, reset_all) will not call. Am I doing
> anything wrong?
> 
> Thanks for advice,
> cheers
> 
> --
> Tom
> 
> Key fingerprint = 06C0 23C6 9EB7 0761 9807  65F4 7F6F 7EAB 496B 28AA
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "web2py-users" group.
> To post to this group, send email to web...@googlegroups.com.
> To unsubscribe from this group, send email to 
> web2py+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/web2py?hl=en.
> 


-- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web...@googlegroups.com.
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en.

Reply via email to