[Zope3-checkins] SVN: zope.formlib/trunk/src/zope/formlib/widget.py Most browsers can now handle the HTML5 required attribute
Charlie Clark
cvs-admin at zope.org
Thu Apr 26 08:49:04 UTC 2012
Log message for revision 125304:
Most browsers can now handle the HTML5 required attribute
Changed:
U zope.formlib/trunk/src/zope/formlib/widget.py
-=-
Modified: zope.formlib/trunk/src/zope/formlib/widget.py
===================================================================
--- zope.formlib/trunk/src/zope/formlib/widget.py 2012-04-26 00:50:50 UTC (rev 125303)
+++ zope.formlib/trunk/src/zope/formlib/widget.py 2012-04-26 08:49:00 UTC (rev 125304)
@@ -176,7 +176,7 @@
>>> provideAdapter(SnippetErrorView,
... (IWidgetInputError, IDefaultBrowserLayer),
... IWidgetInputErrorView, '')
-
+
Whever an error occurs, widgets should set _error:
>>> widget._error = WidgetInputError('foo', 'Foo', ('Err1', 'Err2'))
@@ -357,7 +357,7 @@
>>> widget.getInputValue()
32.0
>>> widget()
- u'<input class="textType" id="field.price" name="field.price" type="text" value="32.00" />'
+ u'<input class="textType" id="field.price" name="field.price" required="True" type="text" value="32.00" />'
>>> request = TestRequest(form={'field.price': u'<p>foo</p>'})
>>> widget = FloatWidget(field, request)
@@ -367,7 +367,7 @@
... print error.doc()
Invalid floating point data
>>> widget()
- u'<input class="textType" id="field.price" name="field.price" type="text" value="<p>foo</p>" />'
+ u'<input class="textType" id="field.price" name="field.price" required="True" type="text" value="<p>foo</p>" />'
>>> tearDown()
@@ -524,6 +524,7 @@
id=self.name,
value=self._getFormValue(),
cssClass=self.cssClass,
+ required=self.required,
extra=self.extra)
def hidden(self):
More information about the Zope3-Checkins
mailing list