Enable/disable p:calendar with h:selectOneRadio

UI Components for JSF
Post Reply
cezarlamann
Posts: 4
Joined: 07 Jan 2011, 15:18
Location: Maringa, PR, Brazil

01 Feb 2011, 21:08

Hi all!

I've not found anything like my case here, then I would ask if is there a way to enable/disable a p:calendar through a h:selectOneRadio and f:selectItem components?

I've already made <p:calendar> work with my app... but with the radiobuttongroup I can't get it to work...

I think I'm doing something wrong but i can't see what is... here is my xhtml:

Code: Select all

<h:form>
      <h:selectOneRadio required="true" requiredMessage="Select one generation type"
                                  style="display:inline" value="#{boletoController.habilitaData}">   
                                  <!-- "habilitaData" is the boolean variable at @MB that I'm using to store "disabled" state -->

      <f:selectItem id="rbtnVenc" itemValue="#{boletoController.desabilita()}" itemLabel="#{bundle.BoletoTitle_GeracaoIndividualProxVenc}"
                           value="#{boletoController.desabilita()}"/> <!-- The "desabilita()" method sets true to the "habilitaData" variable -->

      <f:selectItem id="rbtnData" itemValue="#{boletoController.habilita()}" itemLabel="#{bundle.BoletoTitle_GeracaoIndividualProxData}"
                           value="#{boletoController.habilita()}"/>    <!-- The "habilita()" method sets false to the "habilitaData" variable -->

      </h:selectOneRadio>

      <p:calendar id="VencPersonalizado" disabled="#{boletoController.habilitaData}" locale="pt_BR" 
                        value="#{boletoController.dataVencimento}" pattern="dd/MM/yyyy"/> 
                        <!-- Here, I'm trying to take the boolean attribute from @MB but it's not working... -->

      <h:commandLink action="#{boletoController.gerarUmBoleto(cobrancaController.selected)}" value="#{bundle.GerarPDF}" />
      <!-- Business method that creates an object which optionally uses a Date parameter... -->
</h:form>
Thanks in advance!

Hugs.
JSF 2 + PrimeFaces 2.2.RC2 + Facelets(Mojarra) + GlassfishV3 (3.0.1)

elango
Posts: 2
Joined: 24 Feb 2012, 14:06

29 Feb 2012, 12:44

Hi All,

Any input on this. i tried the same thing. By default, i disabled the calendar and not able to enable it by clicking radio button.

Kindly share appraoch if any for resolving this

Thanks & Regards
Elangovan

norare
Posts: 1
Joined: 21 Mar 2012, 07:53

21 Mar 2012, 08:05

Hi,

I'm trying to do something like that but instead of a radio it is a checkbox and instead of a calendar I'm trying to disable some inputtext, but I'm getting the same problem. Do you have any news? Did you make it work?

Regards,

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 35 guests