Multiselect in javascript
<p>I want both of these multiselect dropdown to have values "All" selected as default.If user doesn't select any thing 
then all will be selected.But user can't select same person as admin and sysadmin.If all gets selected background process will take care of such situation.If User choose any more admin or sysadmin alongside all then also all should get selected with an alert to the user.
How to accheive this? I have done like...</p>

<pre><code>//Select Part
 &lt;tr&gt;
    &lt;td width="15%"&gt;&amp;nbsp;&lt;/td&gt;
 &lt;td width="20%"&gt;   
   &lt;select name="adminKey" id="adminKey" size="10" style="width:160px;" multiple&gt;
  &lt;c:forEach items="${model.adminList}" var = "admin"&gt;
    &lt;option value='&lt;c:out value="${admin.key}"/&gt;' 
     &lt;c:forEach items="${model.adminKey}" var= "adminPk"&gt; 
   &lt;c:if test="${adminPk == admin.key}"&gt;selected&lt;/c:if&gt; &lt;/c:forEach&gt; &gt; 
     &lt;c:out value="${admin.description}"/&gt;&lt;/option&gt;
  &lt;/c:forEach&gt;
   &lt;/select&gt;
 &lt;/td&gt;
 &lt;td width="30%"&gt;&amp;nbsp;&lt;/td&gt;
 &lt;td width="20%"&gt;   
   &lt;select name="sysadminKey" id="sysadminKey" size="10" style="width:160px;" multiple&gt;
   &lt;option value="All" selected&gt;&lt;/option&gt;
  &lt;c:forEach items="${model.sysadminList}" var = "sysadmin"&gt;
    &lt;option value='&lt;c:out value="${sysadmin.key}"/&gt;' 
     &lt;c:forEach items="${model.sysadminKey}" var= "sysPk"&gt; 
   &lt;c:if test="${sysPk == sysadmin.key}"&gt;selected&lt;/c:if&gt; &lt;/c:forEach&gt; &gt; 
     &lt;c:out value="${sysadmin.description}"/&gt;&lt;/option&gt;
  &lt;/c:forEach&gt;
   &lt;/select&gt;
 &lt;/td&gt;
 &lt;td width="15%"&gt;&amp;nbsp;&lt;/td&gt;
  &lt;/tr&gt;

 //Button part
  &lt;td align="left" width="50%"&gt; 
   &lt;input id="assignBtn" type="button" class="button" value="Submit Selection" onClick="selectAll()"/&gt;
  &lt;/td&gt;


 //Javascript part
 function selectAll(){
  var admin = document.getElementById('adminKey');
  var sysadmin = document.getElementById('sysadmin');

  for(j = 0; j &lt; sysadmin.length; j++) { 
    if (sysadmin[j].selected) {
   for(i = 0; i &lt; admin.length; i++) { 
        if (admin[i].selected) {
    if(admin[i].value == sysadmin[j].value){
   alert('admin and sysadmin cannot be the same person');
   return false;
    }    
  }
   }   
 }
  }  
  document.assignPerformerForm.action = 'Some action'; 
  document.assignPerformerForm.submit();   
}
</code></pre>
