--- a/web/form.py Wed Mar 11 11:34:15 2009 +0100
+++ b/web/form.py Wed Mar 11 11:34:46 2009 +0100
@@ -258,12 +258,16 @@
needs_js = ()
needs_css = ()
setdomid = True
+ settabindex = True
- def __init__(self, attrs=None, setdomid=None):
+ def __init__(self, attrs=None, setdomid=None, settabindex=None):
self.attrs = attrs or {}
if setdomid is not None:
# override class's default value
self.setdomid = setdomid
+ if settabindex is not None:
+ # override class's default value
+ self.settabindex = settabindex
def add_media(self, form):
"""adds media (CSS & JS) required by this widget"""
@@ -284,6 +288,8 @@
attrs = dict(self.attrs)
if self.setdomid:
attrs['id'] = form.context[field]['id']
+ if self.settabindex:
+ attrs['tabindex'] = form.req.next_tabindex()
return name, values, attrs
class Input(FieldWidget):
@@ -324,6 +330,7 @@
class HiddenInput(Input):
type = 'hidden'
setdomid = False # by default, don't set id attribute on hidden input
+ settabindex = False
class ButtonInput(Input):
type = 'button'