title: JSF throws argument type mismatch when binding
body: <p>I'm trying to do the following: When the user enters a value in the <code>rich:calendar</code> component, then the <code>h:inputText</code> should have its <code>required</code> attributed set to <code>true</code>. I'm following the instructions in this post: <a href="https://stackoverflow.com/questions/4271794/reference-jsf-controls-attributes-via-javascript">Reference JSF control&#39;s attributes via JavaScript</a></p>
  
  <p><strong>Sorry</strong> for creating another post, but I couldn't figure out how to post the code into the comments area and make it readable. The page throws this error: </p>
  
  <p><code>javax.el.ELException: /pages/overtime/overtime-n.xhtml @121,65 binding="#{oc.overtimeDate}": java.lang.IllegalArgumentException: argument type mismatch</code></p>
  
  <p>The problem is that the binding is inside a <code>c:forEach</code> loop, and I'm trying to use the loop variable to bind to. The <code>overtime.overtimeItems</code> is defined as an <code>ArrayList&lt;OvertimeComponent&gt;</code> with each OvertimeComponent object having various properties (<code>overtimeDate</code>, <code>overtimeDateId</code>, <code>id</code>, <code>overtimeHours</code>, etc.). </p>
  
  <pre><code>&lt;c:forEach items="#{overtime.overtimeItems}" var="oc"&gt;
    &lt;rich:calendar value="#{oc.overtimeDate}" 
      requiredMessage="Date 1 is required."
      id="#{oc.overtimeDateId}" 
      binding="#{oc.overtimeDate}" 
      required="#{oc.id == 1 ? true : false}"&gt;
    &lt;/rich:calendar&gt;
    &lt;h:inputText value="#{oc.overtimeHours}" 
      id="#{oc.overtimeHoursId}"
      requiredMessage="Hours is required." 
      required="#{not empty oc.overtimeDate.value}" &gt;
    &lt;/h:inputText&gt;
    .....
  &lt;/c:forEach&gt;
  </code></pre>
  
  <p>How do I make the <code>h:inputText</code> required if the <code>rich:calendar</code> object has a value? There's a way to do this using the <code>binding</code> property of the calendar, but I'm not sure how to do it inside a <code>c:forEach</code>. I can't use AJAX for this project. Thanks.</p>