prepare a list of "name"s and return that to make it usable in the view
then
{{for nm in name:}}
{{=form.custom.label['nm']}}
{{=form.custom.widget['nm']}}
{{pass}}
On Wednesday, April 17, 2013 5:01:08 PM UTC+2, Domagoj Kovač wrote:
>
> Hi,
>
> i am trying to make a form with dinamic fields and i am using
> SQLFORM.factory. I have a table where i have a list of fields in my form.
>
> in my controller i have:
>
> fields = []
>
> for asset_class_attribute in asset_class_attributes:
>
> field_name = asset_class_attribute.asset_attribute_id.name
>
> fields.append(Field(field_name, requires=IS_NOT_EMPTY()))
>
> form = SQLFORM.factory(*fields)
>
> I my view u would like to do something like this:
>
> <fieldset>
>
> {{if asset_class_attributes:}}
> {{for asset_class_attribute in asset_class_attributes:}}
> <div>
> {{name = asset_class_attribute.asset_attribute_id.name
> }}
> {{=form.custom.label.name}}
> {{=form.custom.widget.name}}
> </div>
>
> {{pass}}
> {{pass}}
>
>
> {{form.custom.submit['_value'] = T("Spremi")}}
> {{=form.custom.submit}}
>
> </fieldset>
>
> I want to make name dynamic:
>
> {{name = asset_class_attribute.asset_attribute_id.name
> }}
> {{=form.custom.label.name}}
> {{=form.custom.widget.name}}
>
> How can i accomplish that?
>
--
---
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.