title: Pass multiple data field from <select multiple> to Django formfield via JQuery .val()
body: <p>I have an application where I have many instances of passing individual html selected user selections to a form field with no problem, but I am struggling to do the same in a multiselect case. It seems that the <code>JQuery.val()</code> function is creating a proper array of data but my formfield on the server shows an empty string. I inherited this application and am somewhat of a noob at this.</p>
  
  <p>The relevant javascript function is</p>
  
  <pre><code>$('.exemptionfield').change(function() {
      var exemptionfield = $(this)
  
      $.ajax({
          url: '/form/ASubstanceExemption',
          type: 'POST',
          data: {
              sclId: $('#sclId').val(),
              substance: exemptionfield.attr('id'),
              exemption: exemptionfield.val()
          }
      })
  })
  </code></pre>
  
  <p>The form looks like</p>
  
  <pre><code>class ASubstanceExemption(forms.Form):
     buttonTitle = 'submit'
     title = 'not used'
  
     sclId = forms.IntegerField()
     substance = forms.CharField()
     exemption = forms.MultipleChoiceField(required=False,
                              choices=kExemptions)
     def handle(self, *args, **kwargs):
        sclId = self.cleaned_data['sclId']
        substance = self.cleaned_data['substance']
        exemption = self.cleaned_data['exemption']
        print exemption
  etc...
  </code></pre>
  
  <p>The HTML select looks like</p>
  
  <pre><code>&lt;select multiple size="5" class="exemptionfield" id="Lead/lead compounds"&gt;
  &lt;option value="1(a)"&gt;
      1(a)
  &lt;/option&gt;
  &lt;option value="1(b)"&gt;
      1(b)
  &lt;/option&gt;
  &lt;option value="1(c)"&gt;
      1(c)
  &lt;/option&gt;
  &lt;option value="1(d)"&gt;
      1(d)
  &lt;/option&gt;
  etc....
  </code></pre>
  
  <p>In cases where I have a single select html drop down and a single choice <code>form.ChoiceField</code>, a selected value (of the type of <code>exemptionfield</code>) will be passed to the exemption variable in my form. Never had a problem there. If I switch to the <code>form.MultipleChoiceField</code> and select a single variable to be passed as in <code>exemptionfield.val()[0]</code> for example, this also works fine. It will come through in the format of (example) <code>[u'1(b)']</code>. But the moment I remove the <code>[0]</code> and only use <code>exemptionfield.val()</code> then it seems like I only receive an empty array in my form. My print action only shows <code>[]</code> as a result. But looking at the values sent by the javascript using an alert function, it tells me it is sending <code>1(b)</code>,<code>1(c)</code>,<code>1(d)</code>.</p>
  
  <p>Any hints where I am going wrong here?
  Thanks.</p>