web/views/forms.py
changeset 7582 dd4487c3f21e
parent 6906 5f13aefb470b
child 7583 6632c762cd63
--- a/web/views/forms.py	Wed Jun 29 18:28:55 2011 +0200
+++ b/web/views/forms.py	Wed Jun 29 18:29:13 2011 +0200
@@ -132,7 +132,6 @@
     needs_js = ('cubicweb.ajax.js', 'cubicweb.edition.js',)
     needs_css = ('cubicweb.form.css',)
     action = None
-    onsubmit = "return freezeFormButtons('%(domid)s');"
     cssclass = None
     cssstyle = None
     cwtarget = None
@@ -146,6 +145,15 @@
         """true if the form needs enctype=multipart/form-data"""
         return any(field.needs_multipart for field in self.fields)
 
+    def _get_onsubmit(self):
+        try:
+            return self._onsubmit
+        except AttributeError:
+            return "return freezeFormButtons('%(domid)s');" % dictattr(self)
+    def _set_onsubmit(self, value):
+        self._onsubmit = value
+    onsubmit = property(_get_onsubmit, _set_onsubmit)
+
     def add_media(self):
         """adds media (CSS & JS) required by this widget"""
         if self.needs_js: