4 Replies Latest reply on May 8, 2009 11:32 AM by ilya_shaikovsky

    commandButton not working in facet

    sticky007

      Does anyone know why a commandButton does not activate when placed inside the rich:calendar header facet tag? Please see the following code. BTW, the managed bean is using session scope. The button on top works, the one in the header facet doesn't:

      <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">


      Calendar Test



      <h:form>

      <a4j:commandButton action="#{myCalendarBean.doNextYear}" rerender="calendar" value="&lt;&lt;"/>

      <rich:calendar id="calendar" mode="ajax" popup="false" value="#{myCalendarBean.selectedDate}">
      <f:facet name="header">
      <a4j:commandButton action="#{myCalendarBean.doNextYear}" value="&lt;&lt;"/>
      </f:facet>
      </rich:calendar>
      <rich:messages/>
      </h:form>



      Thanks,
      R.

        • 1. Re: commandButton not working in facet
          ilya_shaikovsky

          I'll check..

          b.t.w. quick question.. what you need this button to perform?

          • 2. Re: commandButton not working in facet
            ilya_shaikovsky

            https://jira.jboss.org/jira/browse/RF-7069 such construction seems not works at all. :(

            but again desribe please in details what you want to chieve and I'll try to found a solution.

            • 3. Re: commandButton not working in facet
              sticky007

              Thank for looking into this. I am trying to implement my own controls for calendar navigation in my custom "header" facet. The idea is that I have a date range, for example, 05-01-2005 to 08-31-2010 and I wish to prevent the user from navigating the calendar outside of this date range.

              I've only shown one button in my example, but there would be other buttons, i.e. nextMonth, prevMonth, nextYear, prevYear . Each button would call a method in the bean, and result in a call to setCurrentDate on the HtmlCalendar calendar.

              The buttons would be enabled or disabled via other methods, i.e.

              <a4j:commandButton action="#{myCalendarBean.doNextYear}" value="&lt;&lt;" rendered="#{myCalendarBean.isNextYearEnabled}"/>

              This may help too. I see that the generated A4J.AJAX.Submit code for the commandButton in the facet results in a JavaScript syntax error. The 4th argument (parameters?) is missing:

              Error: syntax error
              Source File: http://localhost:7001/CalTest/myCalendar.jsf
              Line: 1, Column: 43
              Source Code:
              A4J.AJAX.Submit('_viewRoot','j_id2',event, );return false;

              • 4. Re: commandButton not working in facet
                ilya_shaikovsky

                check please such customization with controls substitutions like described in guide.

                 <f:facet name="header">
                 <h:panelGroup>
                 <h:outputText value="{nextYearControl}" rendered="#{userBean.available}"/>
                 <h:outputText value="{previousYearControl}" rendered="#{not userBean.available}"/>
                 </h:panelGroup>
                 </f:facet>
                
                


                available just simple boolean in my case.