how can call a method when a date is chosen from a calendar component

UI Components for JSF
Post Reply
fredyprimefaces
Posts: 3
Joined: 18 Feb 2019, 23:08

20 Feb 2019, 20:12

Hi everybody

I am developing a xhtml page and i am adding a calendar component in which I want to execute a method when users choose a date.

<p:outputLabel for="Fecha_cheque" value="Fecha">
</p:outputLabel>
<p:calendar id="Fecha_cheque" title="Fecha" value="#{ctrl_grupo.dto_qldgent.ldesys}" showOn="button" pattern="dd/MM/yyyy" mask="true" required="false">
- <p:ajax listener="#{list_appointments()}"

</p:calendar>
----------
the instruction ajax was supossely to activate the event but it is not allowed in a calendar componet.

is ther any other instruction I can use to activate the even and therefore call de method list_appointments()

thamks

iMikeDeveloper
Posts: 15
Joined: 23 Aug 2018, 14:37

22 Feb 2019, 12:45

Hi

You can use ajax with dateSelect event

Code: Select all

<p:calendar ...>
    <p:ajax event="dateSelect" listener="#{bean.method}"/>
</p:calendar>
IMPORTANT: Your method must be void

Code: Select all

public void method() {

}

fredyprimefaces
Posts: 3
Joined: 18 Feb 2019, 23:08

26 Feb 2019, 00:27

Thanks a lot imikedeveloper. I used it that way and it worked.

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: Carolinagc1985 and 32 guests