Hello Annet,

Don't know if it relevant, but Massimo add this recently :

https://groups.google.com/d/msg/web2py/X5RCYHpckh0/Ut3ijuxiLqAJ

from = SQLFORM(...)
form.add_button("Cancel",URL(r=request,f='new_contact'))

You can do that to : form.add_button(T('Cancel'),
"javascript:void(history.go(-1))")
It will go back of one page, not very good if the user come from the login
page thougth, to be consider if the form is present on the index page for
example, considering user is redirect to index after logon.

Richard

On Sun, Sep 2, 2012 at 3:01 AM, Annet <anneve...@googlemail.com> wrote:

> The signatyre for the SQLFORM constructor has an attribute buttons =
> ['submit']
>
> At the moment I add a cancel and/or reset button to my forms this way:
>
> form=SQLFORM.factory(..)
>     addReserButton(form)
>     addCancelButton(form)
>
>
> def addCancelButton(form):
>
> form[0][-1][1].append(INPUT(_type="button",_value="Annuleer",_onclick="javascript:history.go(-1);"))
>     return None
>
> def addResetButton(form):
>     form[0][-1][1].append(INPUT(_type="reset",_value="Reset"))
>     return None
>
> Is it possible to replace this with something like:
>
> form=SQLFORM.factory(
>
> Field('subClass',...,formstyle='divs',buttons=['submit','reset','cancel'])
>
> ... and replace the functions with a reset and cancel INPUT helper. Where
> would the definition of the INPUT helpers go in my code?
>
>
> Kind regards,
>
> Annet
>
>  --
>
>
>
>

-- 



Reply via email to