As per the question's comments you appear to need action-dependent validation. So the calendar should only be validated as required when a specific action is invoked, which is the main command button action, not the ajax listener action.
This can be solved as per the guidelines found in the related question: Validate input as required only if certain command button is pressed.
<p:calendar ... required="#{not empty param[mainCommandButtonparam.clientId]containsKey(mainCommandButton.clientId)}">
<p:ajax ... />
</p:calendar>
...
<p:commandButton binding="#{mainCommandButton}" ... />
And, in order to retain the 'required asterisk' of the associated <p:outputLabel>
, simply set its indicateRequired
attribute to true
. It will otherwise default to auto
and only be applied when the UIInput#isRequired()
of the associated input component returns true
during render response phase.
<p:outputLabel ... indicateRequired="true" />