p:calendar value not set in backing bean

2019-09-13 03:09发布

Hi I am using PrimeFaces. I have a <p:calendar> in a dialog box and I would type date manual . But my date is not setting in bean's variable. It works for dataSelect event but don't work keypress or keydown event. I am wondering it is also working outside dialog box. Here is my code:

<p:calendar readonlyInput="false" id="Date1" rendered="true"
    navigator="true" showButtonPanel="true"  
    styleClass="form-control cal_input" showOn="both" 
    pattern="#{sessionManager.defaultDateFormat.substring(0,11)}"
    yearRange="#{appLabel['year_Range']}" tabindex="203" 
    value="#{mangeCreateOrdersTO.searchOrderPatientBean.DOB}"
    disabled="false" mask="true"
    maxdate="#{mangeCreateOrdersTO.maxDateOfBirth}"
    autocomplete="#{appLabel['autoCompleteSetting']}"
    onkeypress="return disableEnterKey(event)">
  <p:ajax event="dateSelect" process="@this" partialSubmit="true"  ignoreAutoUpdate="true" update="form:Date1"/>
  <p:ajax event="keydown" process="@this" immediate="true" partialSubmit="true" ignoreAutoUpdate="true" listener="#{mangeCreateOrdersTO.add(mangeCreateOrdersTO.searchOrderPatientBean.DOB)}"/>
</p:calendar>

Please help me to get rid from this problem. Thanks in advance.

1条回答
放我归山
2楼-- · 2019-09-13 03:50

I found what was wrong. So:

My <p:Calendar> must be under the <h:form> which I was missing.

查看更多
登录 后发表回答