One way to test the immediate attribute is to add another input field for validation:
<h:inputText id="testInput" validator="#
{calendarBean.validate2}
" validatorMessage="h:inputText validation failed."
required="true" requiredMessage="h:inputText is required."/>
<h:messages for="testInput"/>
Make it always fail in the validator:
public void validate2(FacesContext context, UIComponent component, java.lang.Object newValue)
{
throw new ValidatorException(new FacesMessage());
}
Press ENTER in the input field, with or without input. Normally, the validation message would always show up for the input field. When immediate is set to true for calendar, calendar's validation is done in Apply Request Values phase. If the validation fails, other phases (including Process Validations phase) are skipped, and the input field won't get any validation or validation message.
See screenshots-03, -04, -05.
valid property is used internally by UIInput in ProcessValidators() and not supposed to be exposed as a tag attribute?