I want to make <p:calendar>
readonly so that users can only choose a date from the calendar because of this issue (this is not a solution though).
For this to be so, I'm doing readonly="#{facesContext.renderResponse}"
as mentioned by this answer like,
<p:calendar id="calendarId"
value="#{bean.property}"
converter="#{jodaTimeConverter}"
pattern="dd-MMM-yyyy hh:mm:ss a"
showOn="button"
readonly="#{facesContext.renderResponse}"
effect="slideDown"
required="true"
showButtonPanel="true"
navigator="true"/>
This works but when the page is loaded (typing the URL in the address bar and then pressing the enter key), facesContext.renderResponse
returns false
and the calendar is no longer readonly. It evaluates to true
, when I submit the form by pressing <p:commandButton>
.
So, how to make the calendar readonly, when the page is loaded?
P.S : I'm using PrimeFaces 3.5 and Mojarra 2.1.9.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…