On 15 November 2012 23:50, Paul Rykiel <[email protected]> wrote:
> I am new to Web2py and I have to do something very basic, but I am not
> certain how to do it, can someone explain.
>
> I want to create an empty form to be used to enter parameters that will
> perform a function, print an "n" number of tags. .
>
> I used the following to create the input fields and than works, however,
> my View is not rendering anything i type into it, such as the "heading"
>
> this is what I did to create the input field
>
> field1 = FORM(INPUT(_type="text", _name="field1" _Label="Field 1)
> field 2 = FORM(INPUT(same)
>
> How do I process the form (all input field on one FORM) , and do I need to
> embedd Python into the HTML to render form?
>
> any assistance would be helpful.
>
>
>
The easiest way to do this is probably to use SQLFORM.factory if you do not
want to put the values entered into a database table or SQLFORM if you do
e.g.
In the controller:
def some_form():
form = SQLFORM.factory(Field('field1', 'text),
Field('field2'))
return dict(form=form)
And in your view:
{{extend 'layout.html'}}
{{=form}}
There are several examples in the book in
http://www.web2py.com/books/default/chapter/29/07.
Regards
Johann
--
Because experiencing your loyal love is better than life itself,
my lips will praise you. (Psalm 63:3)
--