title: Problems Saving Large Number of Attribute Option Labels in Magento
body: <p>I'm running into a problem in a Magento system where saving a large number of attributes either doesn't work at all, or only partially works.  It appears to be a javascript related issue, and I was hoping someone on Stack Overflow had some "known science" for dealing with this situation, or could point me in the right direction.</p>
  
  <p>The basic problem is, the Magento system in question has over 250 color attribute option labels.  If an admin user attempts to manage these by doing the following</p>
  
  <ul>
  <li>Navigating to Catalog -> Attributes -> Manage Attributes</li>
  <li>Selecting the color attributes</li>
  <li>Clicking on the Manage Label/Options tab</li>
  <li>Editing the last Label Option</li>
  <li>Clicking "Save and Continue Edit"</li>
  </ul>
  
  <p>One of two things happens.  </p>
  
  <p>In Google Chrome on OS X, the button sticks in the "depressed" state, and after a period of time Google Chrome's "This page is not responsive" kill dialog comes up.</p>
  
  <p>In a mozilla based browser on OS X, clicking the button makes the browser "think" for a bit, but it eventually submits the form.  <strong>However</strong>, only a partial list of attribute labels is posted to the admin controller.  This means the user can only edit the first 75 - 100 labels, since the other labels are never submitted. </p>
  
  <p>I have reports from windows users describing the second behavior as well (browsers are non-specific)</p>
  
  <p>The obvious answers are to either investigate the poorly performing javascript, or (Grouch Marx style) "don't do that". Before I spend the time profiling/excavating the javascript on that page, I was hoping there was some known fix for this, or specific knowledge as to what was causing the problem.</p>
  
  <p>Magento CE 1.7.x, if it maters.</p>
  
  <p><strong>Update:</strong> The Javascript performance issues are a red herring.  They're caused by the massive number of input fields being iterated through in </p>
  
  <pre><code>js/prototype/validation.js
  </code></pre>
  
  <p>Specifically in this try catch block</p>
  
  <pre><code>    try {
          if(this.options.stopOnFirst) {
              result = Form.getElements(this.form).all(function(elm) {
                  if (elm.hasClassName('local-validation') &amp;&amp; !this.isElementInForm(elm, this.form)) {
                      return true;
                  }
                  return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
              }, this);
          } else {
              result = Form.getElements(this.form).collect(function(elm) {
                  if (elm.hasClassName('local-validation') &amp;&amp; !this.isElementInForm(elm, this.form)) {
                      return true;
                  }
                  return Validation.validate(elm,{useTitle : useTitles, onElementValidate : callback});
              }, this).all();
          }
      } catch (e) {
      }
  </code></pre>
  
  <p>However, even if I short circuit this and have the function return true, the behavior of not saving all the labels persists.    </p>