[form js] apply vgodard patch fixing #750056: reorderTabindex js function crashes when form dom id is not 'entityForm' stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Mon, 22 Mar 2010 16:33:29 +0100
branchstable
changeset 4969 0ad18e41053a
parent 4968 79d80cfaab6f
child 4971 20bffbba7a5a
[form js] apply vgodard patch fixing #750056: reorderTabindex js function crashes when form dom id is not 'entityForm'
web/data/cubicweb.edition.js
--- a/web/data/cubicweb.edition.js	Mon Mar 22 11:11:00 2010 +0100
+++ b/web/data/cubicweb.edition.js	Mon Mar 22 16:33:29 2010 +0100
@@ -35,8 +35,8 @@
  * this function is called when an AJAX form was generated to
  * make sure tabindex remains consistent
  */
-function reorderTabindex(start) {
-    var form = getNode('entityForm');
+function reorderTabindex(start, formid) {
+    var form = getNode(formid || 'entityForm');
     var inputTypes = ['INPUT', 'SELECT', 'TEXTAREA'];
     var tabindex = (start==null)?15:start;
     nodeWalkDepthFirst(form, function(elem) {
@@ -254,7 +254,7 @@
         form.css('display', 'none');
         form.insertBefore(insertBefore).slideDown('fast');
         updateInlinedEntitiesCounters(rtype, role);
-        reorderTabindex();
+        reorderTabindex(null, $(insertBefore).closest('form')[0]);
         jQuery(CubicWeb).trigger('inlinedform-added', form);
         // if the inlined form contains a file input, we must force
         // the form enctype to multipart/form-data