Use form.custom.widget. See http://web2py.com/book/default/section/7/7
for details.

On May 27, 4:48 pm, Mathieu Clabaut <[email protected]> wrote:
> Hello
> In my model, I've a table defined as
>
> STATUS_TYPE = ('identification','analyse')
>
> db.define_table('faq',
>     Field('status', 'string', requires=[IS_IN_SET(STATUS_TYPE,
> multiple=True),
>         IS_NOT_EMPTY(), IS_ORDERED(STATUS_TYPE)],
>         default=STATUS_TYPE[0],
>         widget=SQLFORM.widgets.checkboxes.widget),
>    Field('identification', 'text', requires=IS_NOT_EMPTY(), notnull=True),
>     Field('identification_author',db.auth_user, default=me),
>     Field('identification_date', 'date', ),
>     Field('analyse', 'text'),
>     Field('analyse_author',db.auth_user),
>     Field('analyse_date', 'date'),
> )
>
> I'd like the corresponding form to group fields beginning with
> 'identification' in a single <div name='identification'>, and the fields
> beginning with 'analyse' in a single <div name='analyse'></div> (so as I can
> slide them up and down with a jquery depending of the status selection).
>
> My question is : what is the best way to achieve that ?
> Is there a magical option in the Field initialisation ?
> Shall I define a customize form widget using form.customs.widget[field] with
> a logic to encapsulate the wanted fields ?
>
> I'm interested by your experience on this topic...
>
> -Mathieu
>
> PS. I guess it is quite a newbie question, but it is indeed the first time I
> address form customization...

Reply via email to