On Jul 22, 9:55 pm, Fran <francisb...@googlemail.com> wrote:
> >    3) How to personalize the generated HTML by the CRUD, for example,
> > can I assign an ID or a CSS class for the generated HTML table of
> > select action ?
> Unfortunately crud doesn't support doing things like:
> form = crud.create(db.table, _id='myid', _class='myclass')
> You need to drop down a layer to use SQLFORM for this:
> form = SQLFORM(db.table, _id='myid', _class='myclass')

The other thing you can do is to define in the controller, as-usual:
form = crud.create(db.table)

But then use a custom form in the View:
{{=form.custom.begin}}
{{=form.custom.label.group_id}}
{{=form.custom.widget.group_id}}
{{=form.custom.comment.group_id}}
{{=form.custom.submit}}
{{=form.custom.end}}

& wrap your own custom HTML (with whatever IDs, classes you like)
around that.

NB The default IDs are already very CSS-friendly, so you should be
able to make use of those & not need to define your own.

Going back to the original question I see you were looking at the
output of crud.select() which *does* support the custom attributes I
highlighted earlier, so this works:
crud.select(db.table, _id='myid', _class='myclass')

F
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to