_class not working under Field

33 views
Skip to first unread message

Lucas

unread,
Aug 14, 2025, 6:51:46 AMAug 14
to py4web
hello one and all,

using the latest py4web, 1.20250623.1, with PostgreSQL.  I place a _class under Field, like:

Field('semester_year_i', 'integer', requires=IS_INT_IN_RANGE(2017, 2027), default=2025, _class="year",),

and class will show in the source html but will not equal anything.  I've tried simply [[=form]] or [[=form.custom.widgets['semester_year_i']]] and still class will not equal 'year'.

thank you in advance, Lucas

Lucas

unread,
Aug 15, 2025, 11:33:42 AMAug 15
to py4web
nobody has seen this issue?  is there something I'm missing?  like py4web isn't meant to do this.

Massimo DiPierro

unread,
Aug 15, 2025, 12:43:04 PMAug 15
to Lucas, py4web
It is indeed intentional to decouple presentation info (such as _class) from the validators. This is because different widgets could be used and what the class attribute means would be ambiguous. Some widgets could even have a complex structure which requires multiple classes. You can pass **kwargs to validators but that does not mean they are used.

--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/py4web/5b03b0b4-4d48-4308-872d-e46daf2d2572n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages