[Zope3-checkins] SVN: Zope3/trunk/src/zope/app/form/browser/ Add id to select widget so labels work.

Gary Poster gary at zope.com
Tue Aug 16 20:38:33 EDT 2005


Log message for revision 37976:
  Add id to select widget so labels work.
  
  

Changed:
  U   Zope3/trunk/src/zope/app/form/browser/ftests/test_intwidget.py
  U   Zope3/trunk/src/zope/app/form/browser/itemswidgets.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py
  U   Zope3/trunk/src/zope/app/form/browser/tests/test_selectwidget.py

-=-
Modified: Zope3/trunk/src/zope/app/form/browser/ftests/test_intwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/ftests/test_intwidget.py	2005-08-16 23:05:29 UTC (rev 37975)
+++ Zope3/trunk/src/zope/app/form/browser/ftests/test_intwidget.py	2005-08-17 00:38:32 UTC (rev 37976)
@@ -162,7 +162,7 @@
 
         # confirm that i1 is has a blank item at top with value=""
         self.assert_(patternExists(
-            '<select name="field.i1" .*>', response.getBody()))
+            '<select id="field.i1" name="field.i1" .*>', response.getBody()))
         self.assert_(patternExists(
             '<option value="">.*</option>', response.getBody()))
         self.assert_(patternExists(

Modified: Zope3/trunk/src/zope/app/form/browser/itemswidgets.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/itemswidgets.py	2005-08-16 23:05:29 UTC (rev 37975)
+++ Zope3/trunk/src/zope/app/form/browser/itemswidgets.py	2005-08-17 00:38:32 UTC (rev 37976)
@@ -400,6 +400,7 @@
         contents = "\n%s\n" %"\n".join(rendered_items)
         return renderElement('select',
                              name=self.name,
+                             id=self.name,
                              contents=contents,
                              size=self.size,
                              extra=self.extra)

Modified: Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py	2005-08-16 23:05:29 UTC (rev 37975)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_itemswidget.py	2005-08-17 00:38:32 UTC (rev 37976)
@@ -246,7 +246,7 @@
             widget(),
             '<div>\n'
             '<div class="value">\n'
-            '<select name="field.choice" size="%i" >\n'
+            '<select id="field.choice" name="field.choice" size="%i" >\n'
             '<option value="">(no value)</option>\n'
             '<option selected="selected" value="token1">One</option>\n'
             '<option value="token2">Two</option>\n'
@@ -260,7 +260,7 @@
         widget.setPrefix('field.')
         self.assertEqual(
             widget.renderValue('one'),
-            '<select name="field.choice" size="%i" >\n'
+            '<select id="field.choice" name="field.choice" size="%i" >\n'
             '<option selected="selected" value="token1">One</option>\n'
             '<option value="token2">Two</option>\n'
             '<option value="token3">Three</option>\n'

Modified: Zope3/trunk/src/zope/app/form/browser/tests/test_selectwidget.py
===================================================================
--- Zope3/trunk/src/zope/app/form/browser/tests/test_selectwidget.py	2005-08-16 23:05:29 UTC (rev 37975)
+++ Zope3/trunk/src/zope/app/form/browser/tests/test_selectwidget.py	2005-08-17 00:38:32 UTC (rev 37976)
@@ -41,7 +41,7 @@
 
 select_html = '''<div>
 <div class="value">
-<select name="field.terms" size="5" >
+<select id="field.terms" name="field.terms" size="5" >
 <option value="&lt; foo">&lt; foo</option>
 <option value="bar/&gt;">bar/&gt;</option>
 <option value="&amp;blah&amp;">&amp;blah&amp;</option>



More information about the Zope3-Checkins mailing list