Commits

Anonymous committed 1eb1657

[svn] Sync'd form_tag to 6057. Avoiding 6133:6137 for now
o add id=_method to generated hidden _method fields
o we're not going to deprecate end_tag because we don't do anonymous blocks
w/ tags (the likely reason why they deprecated it). putting off deprecating
start_form as QuickWiki has always used it

Comments (0)

Files changed (4)

tests/test_prototype.py

             form_remote_tag(update=dict(success='glass_of_beer',failure="glass_of_water"),url='http://www.example.com/fast'))
     
     def test_form_remote_tag_with_method(self):
-        self.assertEqual("""<form action=\"http://www.example.com/fast\" method=\"POST\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\"><input name="_method" type="hidden" value="PUT" />""",
+        self.assertEqual("""<form action=\"http://www.example.com/fast\" method=\"POST\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\"><input id="_method" name="_method" type="hidden" value="PUT" />""",
             form_remote_tag(update="glass_of_beer", url='http://www.example.com/fast', html={'method':'PUT'}))
-        self.assertEqual("""<form action=\"http://www.example.com/fast\" method=\"POST\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\"><input name="_method" type="hidden" value="put" />""",
+        self.assertEqual("""<form action=\"http://www.example.com/fast\" method=\"POST\" onsubmit=\"new Ajax.Updater('glass_of_beer', 'http://www.example.com/fast', {asynchronous:true, evalScripts:true, parameters:Form.serialize(this)}); return false;\"><input id="_method" name="_method" type="hidden" value="put" />""",
             form_remote_tag(update="glass_of_beer", url='http://www.example.com/fast', html={'method':'put'}))
 
     def test_on_callbacks(self):

tests/test_url.py

                button_to("Hello", "http://www.example.com", disabled=True))
     
     def test_button_to_with_method_delete(self):
-        self.assertEqual("<form method=\"POST\" action=\"http://www.example.com\" class=\"button-to\"><div><input name=\"_method\" type=\"hidden\" value=\"DELETE\" /><input type=\"submit\" value=\"Hello\" /></div></form>", 
+        self.assertEqual("<form method=\"POST\" action=\"http://www.example.com\" class=\"button-to\"><div><input id=\"_method\" name=\"_method\" type=\"hidden\" value=\"DELETE\" /><input type=\"submit\" value=\"Hello\" /></div></form>", 
             button_to("Hello", "http://www.example.com", method='DELETE'))
-        self.assertEqual("<form method=\"POST\" action=\"http://www.example.com\" class=\"button-to\"><div><input name=\"_method\" type=\"hidden\" value=\"delete\" /><input type=\"submit\" value=\"Hello\" /></div></form>", 
+        self.assertEqual("<form method=\"POST\" action=\"http://www.example.com\" class=\"button-to\"><div><input id=\"_method\" name=\"_method\" type=\"hidden\" value=\"delete\" /><input type=\"submit\" value=\"Hello\" /></div></form>", 
             button_to("Hello", "http://www.example.com", method='delete'))
 
     def test_button_to_with_method_get(self):

webhelpers/rails/form_tag.py

 """
 Form Tag Helpers
 """
-# Last synced with Rails copy at Revision 5045 on Sept. 6th, 2006.
+# Last synced with Rails copy at Revision 6057 on Feb 9th, 2007.
 
 import re
 from urls import confirm_javascript_function
         options['method'] = method
     else:
         options['method'] = "POST"
-        method_tag = tag('input', type="hidden", name_="_method", value=method)
+        method_tag = tag('input', type="hidden", id="_method", name_="_method",
+                         value=method)
     
     options["action"] = url
     return tag("form", True, **options) + method_tag

webhelpers/rails/urls.py

     method_tag = ''
     method = html_options.pop('method', '')
     if method.upper() in ['PUT', 'DELETE']:
-        method_tag = tags.tag('input', type_='hidden', name_='_method', value=method)
+        method_tag = tags.tag('input', type_='hidden', id='_method', name_='_method',
+                              value=method)
     
     form_method = (method.upper() == 'GET' and method) or 'POST'