title: JQuery Dynamic Select Spring Bind
body: <p>I have a problem where I have to dynamically generate dropdown boxes using jquery and spring bind them. I have a list in my form backing object and am attempting to bind it using a counter that increments.</p>
  
  <p>I am getting the follwoing error:</p>
  
  <blockquote>
    <p>org.springframework.beans.InvalidPropertyException: Invalid property 'selectedPermntRestrictCat[ + categoryCounter + ]' of bean class [com.portal.policymanagement.formObject.EditPolicyFormObject]: Invalid index in property path 'selectedPermntRestrictCat[ + categoryCounter + ]'; nested exception is java.lang.NumberFormatException: For input string: " + categoryCounter + "</p>
  </blockquote>
  
  <pre><code>$(document).ready(function(){
      var categoryCounter=0;
      $('#addCategory').click(function() {
          $('&lt;div class="holder"&gt;&lt;div class="left"&gt;&lt;label&gt; &lt;/label&gt;&lt;form:select path="policy.selectedPermntRestrictCat[' + categoryCounter + ']"&gt;&lt;form:option value="0" label="Select" /&gt;&lt;form:option value="6" label="Entertainment" /&gt;&lt;form:option value="7" label="Religion" /&gt;&lt;form:option value="8" label="Weapons" /&gt;&lt;form:option value="9" label="Virtual Community" /&gt;&lt;form:option value="10" label="Hacking" /&gt;&lt;form:option value="11" label="Search Engines" /&gt;&lt;form:option value="12" label="Educational" /&gt;&lt;form:option value="13" label="Other" /&gt;&lt;form:option value="14" label="TEST NON_EXISTANT" /&gt;&lt;form:option value="1" label="Violence" /&gt;&lt;form:option value="2" label="Drugs" /&gt;&lt;form:option value="3" label="Adult Content" /&gt;&lt;form:option value="4" label="Online Resources" /&gt;&lt;form:option value="5" label="Gambling" /&gt;&lt;/form:select&gt;&lt;/div&gt;&lt;div class="right"&gt;&lt;a id="'+i+'" class="but_default" href="#"&gt;Delete&lt;/a&gt;&lt;/div&gt;&lt;div class="errors left"&gt;&lt;/div&gt;&lt;div class="clear"&gt;&lt;/div&gt;&lt;/div&gt;').fadeIn('slow').appendTo('.blockedCategories');
          categoryCounter++;
      });
  });
  </code></pre>