Reputation: 195
Selected date should be displayed in outputText when I select date from calendar control of primefaces. I have written code for this but not worked.
<p:calendar mode="popup" showOn="both" mindate="15-06-2012" pattern="dd-MM-yyyy" effect="fadeIn">
<p:ajax event="keyup" update="out1"/>
</p:calendar><br/><br/><hr/>
<h:outputText id="out1" value="#{sampleBean.selectedDate}"/>
Upvotes: 1
Views: 2377
Reputation: 1476
From your question what i understand is that you want to show the date in ouput which you selected.
for this in your
<p:calendar..... code
add a statement of
value="#{sampleBean.selectedDate}" update=":out1"
This way the selected value will be saved in the selectedDate attribute of your sampleBean.
<h:outputText id="out1" value="#{sampleBean.selectedDate}"/>
Upvotes: 3
Reputation: 418
Well, I'm not sure what you are trying to accomplish but the value returned from the calendar goes to the "value" tag wich is missing, why can't you simply use something like:
<p:calendar value="#{sampleBean.selectedDate}" id="calId" mode="popup" showOn="both" mindate="15-06-2012" pattern="dd-MM-yyyy" effect="fadeIn" />
This should (according to docs and Showcase) should render n input with the calendar just fine...
Upvotes: 1