How to define id for a form created with SQLFORM.factory ?

42 views
Skip to first unread message

at

unread,
Aug 28, 2015, 1:54:08 AM8/28/15
to web2py-users
Hi,

A quick and silly question:
How to define id for a form created with SQLFORM.factory?

Thanks

at

unread,
Aug 28, 2015, 2:55:18 AM8/28/15
to web2py-users
Ok, got it.


myform
= SQLFORM.factory(
       
Field('title', label=T('Title'), requires=IS_NOT_EMPTY()),
.
.
.
       
)
myform
['_id'] = 'myformid'

Anthony

unread,
Aug 28, 2015, 8:54:05 AM8/28/15
to web2py-users
FORM and SQLFORM are just HTML helpers, so you can add HTML attributes to them when they are constructed as well:

myform = SQLFORM.factory(..., _id='myformid')

Anthony

at

unread,
Aug 29, 2015, 1:44:48 PM8/29/15
to web2py-users
Thanks Anthony.
Before posting the question I tried the same and got syntax error as I missed the ','  
Reply all
Reply to author
Forward
0 new messages