title: Java - FormData in IE throwing org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Stream ended unexpectedly
body: <p>I am having an IE specific issue with a web application which was built in Java. On AJAX submission of a multi-part form, only in IE, I am seeing a MalformedStreamException. The form submits perfectly in FF and Chrome.</p>
  
  <p>I've been banging my head against the wall trying to pinpoint exactly when this issue arose and what could be causing it but I've been unable to track that down. I have noticed that removing the [0] from the FormData object causes the form to submit correctly. However, doing that breaks the image submission which I assume is because of how the FormData object is formatted. I've included the HTML and Javascript for one of our broken forms. Any help would be greatly appreciated.</p>
  
  <p><strong>JSP</strong></p>
  
  <pre><code>&lt;form:form class="scrollingContent bbq" name="addArtistForm" id="addArtistForm" modelAttribute="artistModel"
           method="post" enctype="multipart/form-data"&gt;
  
              &lt;div class="step cf" id="addArtist-1"&gt;
                  &lt;div class="ediv errorMessage"&gt;&lt;/div&gt;
  
                  &lt;%--&lt;div class="dividedRow row cf"&gt;
                      &lt;div class="left modalLabel standardLabel"&gt;
                          &lt;label for="fbArtistID"&gt;Start With A &lt;a target="_blank" href="https://developers.facebook.com/tools/explorer?method=GET&amp;path=TheLostOnion" title="Find Your Facebook Artist ID Here"&gt;&lt;span class="green"&gt;Facebook
                                  ID&lt;/span&gt;&lt;/a&gt; &lt;/label&gt;
                                  &lt;p class="helpText"&gt;Paste your Facebook Path in the Get field, not including the "facbook.com/", then click submit and look for your "id"&lt;/p&gt;
                      &lt;/div&gt;
                      &lt;div class="right modalField"&gt;
                          &lt;input type="text" name="fbArtistID" id="fbArtistID" /&gt; &lt;input
                              type="button" name="fbGo" id="fbGo" class="silverBtn noShadow"
                              value="Go &amp;raquo;" onclick="fbLogin()" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;!-- /.dividedRow --&gt;
                  --%&gt;
  
                  &lt;div class="fieldBlock row cf"&gt;
                      &lt;div class="left modalLabel standardLabel"&gt;
                          &lt;label for="artistName"&gt;Artist Name&lt;span class="red"&gt;*&lt;/span&gt;
                          &lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class="right modalField"&gt;
                          &lt;input type="text" name="artistName" id="artistName1" class="ajaxSearch" onkeyup="getArtistListForArtist(this, 'membersstate2', 'artistMembersId')"/&gt;
                          &lt;p class="helpText"&gt;Please make sure your Artist is not ALREADY in the database from other fans and Promoters who add artists, type each keyword of your artist name and look to see if your artist listing comes up on the right - if it does, click on it and then CLAIM it so you can manage it!&lt;/p&gt;
                          &lt;%--                            &lt;form:input path="artistName" id="artistName" /&gt; --%&gt;
  
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
  
                  &lt;div class="fieldBlock row cf"&gt;
                      &lt;div class="left modalLabel standardLabel"&gt;
                          &lt;label for="artistPrevName"&gt;Alias/Previous Name&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;div class="right modalField"&gt;
                          &lt;!--                            &lt;input type="text" name="artistPrevName" id="artistPrevName" /&gt; --&gt;
                          &lt;form:input path="previousName" id="previousName" /&gt;
                          &lt;form:errors path="previousName" class="red" /&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
  
                  &lt;div class="fieldBlock row cf"&gt;
                      &lt;div class="left modalLabel standardLabel"&gt;
                          &lt;label for="location"&gt;Location&lt;span class="red"&gt;*&lt;/span&gt; &lt;/label&gt;
                          &lt;p class="helpText"&gt;Where is this Artist based out of?  Choose the Best Possible Answer, if you're not sure, this can be updated later&lt;/p&gt;
                          &lt;p class="helpText"&gt;&lt;a href="https://maps.google.com/" target="_blank"&gt;Search on Google Maps in a New Tab&lt;/a&gt;&lt;/p&gt;
                      &lt;/div&gt;
  
                      &lt;div class="right modalField"&gt;
  
                          &lt;div class="fieldSet"&gt;
                              &lt;select id="artistState" name="artistState"&gt;&lt;/select&gt;
                              &lt;p class="helpText"&gt;State&lt;/p&gt;
                          &lt;/div&gt;&lt;!-- /.fieldSet --&gt;
  
                          &lt;div class="fieldSet"&gt;
                              &lt;div&gt;&lt;select id="artistCity" name="artistCity"&gt;&lt;/select&gt;&lt;/div&gt;
                              &lt;p class="helpText"&gt;City&lt;/p&gt;
                          &lt;/div&gt;
  
                          &lt;span class="helpText sep"&gt;Or&lt;/span&gt;
  
                          &lt;div class="fieldSet"&gt;
                              &lt;form:input path="zipcode" id="zipcode" /&gt;
                              &lt;p class="helpText"&gt;Zip Code&lt;/p&gt;
                          &lt;/div&gt;
                          &lt;!-- /.fieldSet --&gt;
  
  
                     &lt;/div&gt;&lt;!-- /.modalField --&gt;
  
  
                      &lt;!--&lt;div class="right modalField"&gt;
  
                          &lt;div class="fieldSet upSet"&gt;
  
                              &lt;p class="helpText"&gt;State&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;City/Town&lt;/p&gt;
                              &lt;select id="artistState" name="artistState"&gt;&lt;/select&gt;
                              &lt;div style="float: right;"&gt;
  
                                  &lt;select id="artistCity" name="artistCity"&gt;&lt;/select&gt;
  
                              &lt;/div&gt;
                          &lt;/div&gt;
  
                      &lt;/div&gt;--&gt;
                      &lt;!-- /.right --&gt;
  
                  &lt;/div&gt;&lt;!-- /.fieldBlock --&gt;
  
  
                  &lt;div class="fieldBlock cf"&gt;
                      &lt;div class="left modalLabel"&gt;
                          &lt;label for="genreSlider_AddArtist"&gt;Main Genres&lt;span class="red"&gt;*&lt;/span&gt;
                          &lt;/label&gt;
                          &lt;p class="helpText"&gt;*Choose Up To 3&lt;/p&gt;
                          &lt;p class="helpText"&gt;Choose the Best Answers, you'll be able to provide a "Genre in Your Own Words" later&lt;/p&gt;
                      &lt;/div&gt;
  
                      &lt;div class="right modalField"&gt;
                          &lt;h3&gt;Choose UP TO 3 Best Answers&lt;/h3&gt;
                          &lt;ul id="genreSlider_AddArtist" class="row floatLabels genreSlider"&gt;
  
                              &lt;c:forEach items="${childGenres}" var="childgenre" varStatus="loop"&gt;
                                  &lt;c:set var="rootGenreName" value="${childgenre.key}"&gt;&lt;/c:set&gt;
  
                                  &lt;li&gt;&lt;hgroup&gt;
                                      &lt;h4&gt;${rootGenreName}&lt;/h4&gt;
                                      &lt;/hgroup&gt; &lt;!-- /.cbSet --&gt;
                                      &lt;div class="left"&gt;
                                          &lt;c:set value="${fn:length(childgenre.value) }" var="genreCount" /&gt;
                                          &lt;c:choose&gt;
                                              &lt;c:when test="${genreCount &gt; 0}"&gt;
                                                  &lt;c:set value="${ (genreCount/2) + (1 - ((genreCount/2) % 1)) % 1}" var="genreHalf" /&gt;
                                              &lt;/c:when&gt;
                                              &lt;c:otherwise&gt;
                                                  &lt;c:set value="1" var="genreHalf" /&gt;
                                              &lt;/c:otherwise&gt;
                                          &lt;/c:choose&gt;
  
                                          &lt;c:forEach items="${childgenre.value}" begin="0" end="${ genreHalf - 1 }"
                                              var="genre"&gt;
                                              &lt;div class="cbSet"&gt;
                                                  &lt;form:input type="checkbox" path="genres" id="genre-${ genre.id }-CB_2" 
                                                      value="${genre.id}" /&gt;
                                                  &lt;label for="genre-${ genre.id }-CB_2" class="checkBtn"&gt;${genre.genreName}&lt;/label&gt;
                                              &lt;/div&gt;
                                              &lt;!-- /.cbSet --&gt;
                                          &lt;/c:forEach&gt;
                                          &lt;!--/c:forEach--&gt;
  
                                      &lt;/div&gt;
                                      &lt;div class="right"&gt;
                                          &lt;c:forEach items="${childgenre.value}" begin="${ genreHalf }" var="genre"&gt;
                                              &lt;div class="cbSet"&gt;
                                                  &lt;form:input type="checkbox" id="genre-${ genre.id }-CB_2" path="genres"
                                                      class="genre caCB" value="${genre.id}" /&gt;
                                                  &lt;label for="genre-${ genre.id }-CB_2" class="checkBtn"&gt;${genre.genreName}&lt;/label&gt;
                                              &lt;/div&gt;
                                              &lt;!-- /.cbSet --&gt;
                                          &lt;/c:forEach&gt;
                                      &lt;/div&gt;
                                  &lt;/li&gt;
                                  &lt;c:if test="${loop.last}"&gt;
                                      &lt;li&gt;
                                          &lt;p class="sliderText"&gt;
  
                                          &lt;/p&gt;
                                      &lt;/li&gt;
                                  &lt;/c:if&gt;
                              &lt;/c:forEach&gt;
                          &lt;/ul&gt;
                          &lt;!-- #genreSlider --&gt;
                      &lt;/div&gt;
                      &lt;!-- /.right --&gt;
  
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
  
  
  
                  &lt;div class="fieldBlock cf"&gt;
  
                      &lt;div class="modalLabel left standardLabel"&gt;
                          &lt;label&gt;Logo/Photo&lt;/label&gt;
                          &lt;p class="helpText"&gt;This is the main image that will appear for
                              your Artist Listing on all pages of the site. Should be at least 240px wide, and under 1500px wide.&lt;/p&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalLabel --&gt;
  
                      &lt;div class="right modalField"&gt;
                          &lt;input type="file" name="artistLogo" id="artistLogo"/&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalField --&gt;
  
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
  
  
                  &lt;div class="fieldBlock cf"&gt;
  
                      &lt;div class="modalLabel left standardLabel"&gt;
                          &lt;label&gt;Header Image&lt;/label&gt;
                          &lt;p class="helpText"&gt;This is the image that will appear at the
                              top of your Artist Page.  Should be at least 600px wide, the height can vary, shoot for at least 200px tall.&lt;/p&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalLabel --&gt;
  
                      &lt;div class="modalField right"&gt;
  
                          &lt;input type="file" name="artistHeaderImage" id="artistHeaderImage" /&gt;
  
                      &lt;/div&gt;
                      &lt;!-- /.modalField --&gt;
  
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
  
  
  
                  &lt;div class="fieldBlock cf"&gt;
                      &lt;div class="left modalLabel"&gt;
                          &lt;label&gt;CLAIM?&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalLabel --&gt;
                      &lt;div class="right modalField"&gt;
                          &lt;div class="cbSet"&gt;
                              &lt;form:input path="isClaimed" id="claim" name="claim" type="checkbox" value="true" /&gt;
                              &lt;span&gt;Do you represent this artist?&lt;/span&gt;
                          &lt;/div&gt;
                          &lt;!-- /.cbSet --&gt;
                          &lt;div class="claimWarning"&gt;
                              &lt;p class="small"&gt;Claims are normally processed within an hour, but can take up to 24hrs depending on day of week and time of day.  Thanks!&lt;/p&gt;
                          &lt;/div&gt;&lt;!-- /."claimWarning" --&gt;
  
                      &lt;/div&gt;
                      &lt;!-- /.modalField --&gt;
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
              &lt;/div&gt;
              &lt;!-- /.step#1 --&gt;
  
              &lt;div class="step cf" id="addArtist-2"&gt;
              &lt;div class="ediv2 errorMessage"&gt;&lt;/div&gt;
                  &lt;h3&gt;Connect&lt;/h3&gt;
                  &lt;div class="fieldBlock cf"&gt;
                      &lt;div class="left modalLabel standardLabel"&gt;
                          &lt;label for="artistPhone"&gt;Primary Contact Phone&lt;/label&gt;
                          &lt;p class="helpText"&gt;This information will not be made public, it for our staff to be able to reach you to assist with any issues.&lt;/p&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalLabel --&gt;
  
                      &lt;div class="right modalField"&gt;
                          &lt;input type="text" name="primaryContactPhone" id="artistPhone" maxlength="15" /&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalField --&gt;
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
  
                  &lt;div class="fieldBlock cf"&gt;
                      &lt;div class="left modalLabel standardLabel"&gt;
                          &lt;label for="artistEmail"&gt;Primary Contact Email&lt;/label&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalLabel --&gt;
  
                      &lt;div class="right modalField"&gt;
                          &lt;form:input type="text" path="artistEmail" /&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalField --&gt;
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
  
                  &lt;div class="fieldBlock dividedRow cf"&gt;
                      &lt;div class="left modalLabel"&gt;
                          &lt;label&gt;Web Links&lt;/label&gt;
                          &lt;p class="helpText"&gt;Add as many as you like - Please include http://&lt;/p&gt;
                      &lt;/div&gt;
                      &lt;fieldset id="artistConnectSection_1"
                          class="repeatingSection right modalField"&gt;
  
                          &lt;div class="bottomMargin"&gt;
                              &lt;div class="fieldSet"&gt;
                                  &lt;input type="text" name="url" id="artistConnect_1" class="artistConnect_1"/&gt;
                              &lt;/div&gt;
                              &lt;!-- /.fieldSet --&gt;
  
                              &lt;div class="fieldSet"&gt;
                                  &lt;select class="styled" name="urlType"&gt;
                                      &lt;c:set var="PersonalLink" value="${PersonalLinkList}" /&gt;
                                      &lt;c:forEach var="links" items="${PersonalLink}"&gt;
                                          &lt;option value="${links.id}"&gt;
                                              &lt;c:out value="${links.linkName}" /&gt;
                                          &lt;/option&gt;
                                      &lt;/c:forEach&gt;
                                  &lt;/select&gt;
                              &lt;/div&gt;
                              &lt;!-- /.fieldSet --&gt;
  
                              &lt;div class="fieldSet"&gt;
                                  &lt;input type="button" title="Remove"
                                      class="deleteField silverBtn smallBtn" value="X" /&gt;
                              &lt;/div&gt;
                              &lt;!-- /.fieldSet --&gt;
                          &lt;/div&gt;
                          &lt;!-- modalField --&gt;
                      &lt;/fieldset&gt;
  
                      &lt;div class="modalField right"&gt;
                          &lt;input type="button" title="Add Another"
                              class="addField silverBtn smallBtn" value="+" /&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalField --&gt;
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
  
                  &lt;!-- /.fieldBlock --&gt;
  
                  &lt;h3&gt;About&lt;/h3&gt;
                  &lt;div class="dividedRow"&gt;
  
                      &lt;div class="fieldBlock cf"&gt;
                          &lt;div class="modalLabel left standardLabel"&gt;
                              &lt;label&gt;Artist Type&lt;/label&gt;
                              &lt;p class="helpText"&gt;What do people refer to you as?  Choose the Best Answer&lt;/p&gt;
                          &lt;/div&gt;
                          &lt;div class="modalField right"&gt;
                              &lt;select class="styled" name="artistType"&gt;
                                  &lt;c:set var="ArtistType" value="${ArtistTypeList}" /&gt;
                                  &lt;c:forEach var="type" items="${ArtistType}"&gt;
                                      &lt;option value="${type.id}"&gt;
                                          &lt;c:out value="${type.artistTypeName}" /&gt;
                                      &lt;/option&gt;
                                  &lt;/c:forEach&gt;
                              &lt;/select&gt;
                          &lt;/div&gt;
                          &lt;!-- /.modalField --&gt;
  
                          &lt;!-- /.modalField --&gt;
                      &lt;/div&gt;
                      &lt;!-- /.fieldBlock --&gt;
  
                      &lt;div class="fieldBlock cf"&gt;
                          &lt;div class="modalLabel left tallLabel"&gt;
                              &lt;label&gt;Established&lt;/label&gt;
                          &lt;/div&gt;
                          &lt;!-- /.modalLabel --&gt;
  
                          &lt;div class="modalField right"&gt;
                              &lt;div class="fieldSet"&gt;
                                  &lt;p class="helpText"&gt;Month&lt;/p&gt;
                                  &lt;select class="styled" name="establishedMonth"&gt;
                                      &lt;option value=""&gt;Select&lt;/option&gt;
                                      &lt;option value="Jan"&gt;Jan&lt;/option&gt;
                                      &lt;option value="Feb"&gt;Feb&lt;/option&gt;
                                      &lt;option value="Mar"&gt;Mar&lt;/option&gt;
                                      &lt;option value="Apr"&gt;Apr&lt;/option&gt;
                                      &lt;option value="May"&gt;May&lt;/option&gt;
                                      &lt;option value="Jun"&gt;Jun&lt;/option&gt;
                                      &lt;option value="Jul"&gt;Jul&lt;/option&gt;
                                      &lt;option value="Aug"&gt;Aug&lt;/option&gt;
                                      &lt;option value="Sep"&gt;Sep&lt;/option&gt;
                                      &lt;option value="Oct"&gt;Oct&lt;/option&gt;
                                      &lt;option value="Nov"&gt;Nov&lt;/option&gt;
                                      &lt;option value="Dec"&gt;Dec&lt;/option&gt;
                                  &lt;/select&gt;
                              &lt;/div&gt;
                              &lt;!-- /.fieldSet --&gt;
  
                              &lt;div class="fieldSet"&gt;
                                  &lt;p class="helpText"&gt;Year&lt;/p&gt;
  
                                  &lt;%  java.util.Date dNow = new java.util.Date(); 
                                      java.text.SimpleDateFormat simpleDateFormat = new java.text.SimpleDateFormat("yyyy"); 
                                      int start = Integer.valueOf(simpleDateFormat.format(dNow)); 
                                      int diff = start - 1950; 
                                  %&gt; 
                                  &lt;select class="styled" name="establishedYear"&gt;
                                      &lt;option value="0"&gt;Select&lt;/option&gt;
                                  &lt;%  
                                      for (int i = 0; i &lt;= diff; i++) { 
                                  %&gt; 
                                      &lt;option value="&lt;%=start%&gt;"&gt;&lt;%=start%&gt;&lt;/option&gt; 
                                  &lt;%  start--; } %&gt; 
                                  &lt;/select&gt;
  
  
                                  &lt;!-- &lt;select class="styled" name="establishedYear"&gt;
                                      &lt;option value="1995"&gt;1995&lt;/option&gt;
                                      &lt;option value="1996"&gt;1996&lt;/option&gt;
                                      &lt;option value="1997"&gt;1997&lt;/option&gt;
                                      &lt;option value="1998"&gt;1998&lt;/option&gt;
                                      &lt;option value="1999"&gt;1999&lt;/option&gt;
                                      &lt;option value="2000"&gt;2000&lt;/option&gt;
                                      &lt;option value="2001"&gt;2001&lt;/option&gt;
                                      &lt;option value="2002"&gt;2002&lt;/option&gt;
                                      &lt;option value="2003"&gt;2003&lt;/option&gt;
                                      &lt;option value="2004"&gt;2004&lt;/option&gt;
                                      &lt;option value="2005"&gt;2005&lt;/option&gt;
                                      &lt;option value="2006"&gt;2006&lt;/option&gt;
                                      &lt;option value="2007"&gt;2007&lt;/option&gt;
                                      &lt;option value="2008"&gt;2008&lt;/option&gt;
                                      &lt;option value="2009"&gt;2009&lt;/option&gt;
                                      &lt;option value="2010"&gt;2010&lt;/option&gt;
                                      &lt;option value="2011"&gt;2011&lt;/option&gt;
                                      &lt;option value="2012"&gt;2012&lt;/option&gt;
                                      &lt;option value="2013"&gt;2013&lt;/option&gt;
                                  &lt;/select&gt;
                                   --&gt;
                              &lt;/div&gt;
                              &lt;!-- /.fieldSet --&gt;
  
                          &lt;/div&gt;
                          &lt;!-- /.modalField --&gt;
                      &lt;/div&gt;
                      &lt;!-- /.fieldBlock --&gt;
  
                      &lt;div class="fieldBlock cf"&gt;
                          &lt;div class="modalLabel left standardLabel"&gt;
                              &lt;label&gt;Status&lt;/label&gt;
                          &lt;/div&gt;
  
                          &lt;div class="modalField right"&gt;
                              &lt;form:select path="status" class="styled" name="status"&gt;
                                  &lt;option value="-1"&gt;Select&lt;/option&gt;
                                  &lt;c:set var="StatusList" value="${StatusList}" /&gt;
                                  &lt;c:forEach var="status" items="${StatusList}"&gt;
                                      &lt;option value="${status.id}"&gt;
                                          &lt;c:out value="${status.statusValue}" /&gt;
                                      &lt;/option&gt;
                                  &lt;/c:forEach&gt;
                              &lt;/form:select&gt;
                          &lt;/div&gt;
                          &lt;!-- /.modalField --&gt;
                          &lt;!-- /.modalField --&gt;
                      &lt;/div&gt;
                      &lt;!-- /.fieldBlock --&gt;
  
                      &lt;div class="fieldBlock cf"&gt;
                          &lt;div class="modalLabel left standardLabel"&gt;
                              &lt;label&gt;Stature&lt;/label&gt;
                              &lt;p class="helpText"&gt;If you commonly play more than 50 miles from your hometown, you are probably a regional artist.  If you commonly perform over 500 miles from your hometown, you are probably a national artist!&lt;/p&gt;
                          &lt;/div&gt;
                          &lt;div class="modalField right"&gt;
                              &lt;form:select path="stature" class="styled" name="stature"&gt;
                                  &lt;c:set var="StatureList" value="${StatureList}" /&gt;
                                  &lt;c:forEach var="stature" items="${StatureList}"&gt;
                                      &lt;option value="${stature.id}"&gt;
                                          &lt;c:out value="${stature.statureValue}" /&gt;
                                      &lt;/option&gt;
                                  &lt;/c:forEach&gt;
                              &lt;/form:select&gt;
                          &lt;/div&gt;
                          &lt;!-- /.modalField --&gt;
                          &lt;!-- /.modalField --&gt;
                      &lt;/div&gt;
                      &lt;!-- /.fieldBlock --&gt;
  
                  &lt;/div&gt;
                  &lt;!-- /.dividedRow --&gt;
  
                  &lt;h3&gt;Sound&lt;/h3&gt;
                  &lt;div class="fieldBlock cf"&gt;
                      &lt;div class="modalLabel left standardLabel"&gt;
                          &lt;label for="specificGenre"&gt;Genre (In Your Own Words)&lt;/label&gt;
                          &lt;p class="helpText"&gt;What Would You Say Your Genre is?&lt;/p&gt;
                      &lt;/div&gt;
                      &lt;!-- /.modalLabel --&gt;
  
                      &lt;div class="modalField right"&gt;
                          &lt;form:input type="text" path="ownWord" name="specificGenre"
                              id="ownWord" /&gt;
                      &lt;/div&gt;
  
                      &lt;!-- /.modalField --&gt;
                  &lt;/div&gt;
                  &lt;!-- /.fieldBlock --&gt;
              &lt;/div&gt;
  
              &lt;!-- /.step --&gt;
  
              &lt;div class="step cf" id="addArtist-3"&gt;
                  &lt;div class="edivMember1 errorMessage"&gt;&lt;/div&gt;
                  &lt;div class="edivMember errorMessage"&gt;&lt;/div&gt;
                  &lt;!--&lt;ul class="windowStates cf"&gt;
                                              &lt;li&gt;&lt;a href="#members-state1"&gt;State 1&lt;/a&gt;&lt;/li&gt;
                                              &lt;li&gt;&lt;a href="#members-state2"&gt;State 2&lt;/a&gt;&lt;/li&gt;
                  &lt;/ul&gt;--&gt;
  
                  &lt;h3&gt;Members&lt;/h3&gt;
                  &lt;div class="cf addedMembers"&gt;
  
                      &lt;!-- State 1 --&gt;
                      &lt;div id="members-state1" class="cf selectedList"&gt;&lt;/div&gt;
  
                      &lt;!-- State 2 --&gt;
                      &lt;div id="membersstate2" class="cf selectedList"&gt;
                          &lt;!-- &lt;div class="member"&gt;
                                      &lt;h3&gt;Dan Shedd&lt;/h3&gt;
                                      &lt;p&gt;Boston, MA&lt;/p&gt;
                                      &lt;p class="smDetail"&gt;Vocals, Guitar&lt;/p&gt;
                                      &lt;input type="button" class="close right silverBtn smallBtn"
                                          value="X" /&gt;
                                  &lt;/div&gt; --&gt;
                          &lt;!-- /.member --&gt;
                      &lt;/div&gt;
                      &lt;!-- /.selectedList --&gt;
  
                  &lt;/div&gt;
                  &lt;!-- /.addedMembers --&gt;
                  &lt;!-- &lt;input type="hidden" name="artistMembersId" id="artistMembersId" /&gt; --&gt;
                  &lt;div class="dividedRow"&gt;
                      &lt;h3&gt;Add Member&lt;/h3&gt;
                      &lt;p class="helpText"&gt;(From user account)&lt;/p&gt;
  
                      &lt;div class="fieldBlock cf"&gt;
                          &lt;div class="left modalLabel standardLabel"&gt;
                              &lt;label for="existingMembers"&gt;Search Existing&lt;/label&gt;
                          &lt;/div&gt;
                          &lt;!-- /.modalLabel --&gt;
  
                          &lt;div class="right modalField"&gt;
                              &lt;input type="text" id="existingMembers" class="ajaxSearch"
                                  onkeyup="getUserListInDiv(this, 'membersstate2', 'artistMembersId','search')" /&gt;
                          &lt;/div&gt;
                          &lt;!-- /.modalField --&gt;
                      &lt;/div&gt;
                      &lt;!-- /.fieldBlock --&gt;
                  &lt;/div&gt;
                  &lt;!-- /.dividedRow ---&gt;
  
  
  
              &lt;/div&gt;
              &lt;!-- /.step --&gt;
  
              &lt;div class="fieldBlock left cf"&gt;
                  &lt;input type="reset" class="silverBtn back" /&gt;
              &lt;/div&gt;
              &lt;!-- /.fieldBlock --&gt;
              &lt;div class="fieldBlock right cf"&gt;
                  &lt;!-- &lt;input type="button" class="silverBtn" value="Save &amp; Close"
                          name="save&amp;Close" /&gt; --&gt;
                  &lt;!-- &lt;input type="button" class="silverBtn" value="Save &amp; New" name="save&amp;New" onclick="save()" /&gt; --&gt;
  
                  &lt;!-- &lt;input type="button" class="silverBtn" value="Save &amp; New"
                          name="save&amp;New" /&gt; --&gt;
                  &lt;input type="submit" id="submitQuery" class="greenBtn next" name="submitQuery" /&gt;
              &lt;/div&gt;
  
              &lt;!-- /.fieldBlock--&gt;
          &lt;/form:form&gt;
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>        jQuery("form#addArtistForm")
          .submit(function(event) {
              event.preventDefault();
  
              var isValid=$("#addArtistForm").valid();
  
              if(isValid){
                  $("#addArtist #submitQuery").fadeOut(function(){
                      $("#addArtist #submitQuery").after('&lt;img src="/ArtistBomb/resources/images/loading.gif" class="loadSpin" width="40" height="40" /&gt;');
                      var str = new FormData($("form#addArtistForm")[0]);
                      $.ajax({
                          type : "POST",
                          data : str,
                          url : "/ArtistBomb/artist/addNewArtist.htm",
                          async : true,
                          success : function(data) {
                              alert(data);
                              if(data=='Artist added successfully'){
                                  //window.location.href = location.href;
                                  window.location.reload();
                              }
                              else{
                                  $("#addArtist .loadSpin").remove();
                                  $("#addArtist #submitQuery").fadeIn();
                              }
  
                          },
                          cache : false,
                          contentType : false,
                          processData : false
                      });
                  });
              }
      });
  </code></pre>
  
  <p>Thanks!</p>