Add a hidden input:submit field in facets form (closes #1988784) stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 11 Oct 2011 16:01:44 +0200
branchstable
changeset 7939 e107204d3b27
parent 7938 80c6e2155c3d
child 7941 018b5deca73e
Add a hidden input:submit field in facets form (closes #1988784) <Enter> is supposed to submit the form only if there is a single input:text field. However most browsers will submit the form on <Enter> anyway if there is an input:submit field. see: http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2 Firefox 7.0.1 does not submit form on <Enter> if there is more than a input:text field and not input:submit but does it if there is an input:submit. IE 6 or Firefox 2 behave the same way.
web/views/facets.py
--- a/web/views/facets.py	Tue Oct 11 18:18:14 2011 +0200
+++ b/web/views/facets.py	Tue Oct 11 16:01:44 2011 +0200
@@ -133,6 +133,20 @@
             hiddens['mainvar'] = mainvar
         filter_hiddens(w, baserql, wdgs, **hiddens)
         self.layout_widgets(w, self.sorted_widgets(wdgs))
+
+        # <Enter> is supposed to submit the form only if there is a single
+        # input:text field. However most browsers will submit the form
+        # on <Enter> anyway if there is an input:submit field.
+        #
+        # see: http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2
+        #
+        # Firefox 7.0.1 does not submit form on <Enter> if there is more than a
+        # input:text field and not input:submit but does it if there is an
+        # input:submit.
+        #
+        # IE 6 or Firefox 2 behave the same way.
+        w(u'<input type="submit" class="hidden" />')
+        #
         w(u'</fieldset>\n')
         w(u'</form>\n')