title: Calling a Bean Function in a JavaScript if statement for eveluating Primefaces object
body: <p>I am using Primefaces Schedule and I am using  which has a listener parameter of <code>org.primefaces.event.DateSelectEvent</code>. 
  Based on whether DateSelectEvent.getDate is a weekeday or a weekend, I need to open a dialog box or just disable ajax (or don't do anything). For that I need to make a decision in the oncompelete attribute of . I have gone as far as this:</p>
  
  <pre><code>&lt;p:ajax event="dateSelect" listener="#{myBean.onDateSelect}" oncomplete="
         if (onDateSelect.getDate == WeekDay) { 
             eventDialog.show()
         } else {
             myschedule.update()
         }"
  &gt;
  </code></pre>
  
  <p>Well, obviously <code>onDateSelect.getDate == Weekday</code> doesn't work and must be taken care of by a function on my backing bean, but how can I evaluate my backing bean method in JS function?</p>