On Saturday, August 3, 2013 6:21:22 AM UTC-4, David Marko wrote:
> I would like to add more buttons to SQLFORM using the syntax below. How
> can I address these buttons on template when I render content manualy? For
> common submit filed I'm using {{=form.custom.submit}} ... how to address
> these additional buttons?
>
> form.add_button('Back', URL('other_page'))
>
> In the above case, all the buttons (including the original submit button)
will be in form.custom.submit.parent (which is a TD object if your form
uses one of the table formats). To access the list, you can do
form.custom.submit.parent.components, and then index that to get a
particular button.
buttons = [TAG.button('Back',_type="button",_onClick = "parent.location='%s' "
% URL(...),
> TAG.button('Next',_type="submit")]
>
> The above is just a list of buttons, so include them in your view as you
would any other helper objects:
{{=buttons[0]}}
As long as you're constructing custom HTML for the form, another option is
just to create the buttons in HTML (or using web2py helpers) right where
you need them in the template.
Anthony
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.