i have created a custom validator class to do some logic whether the input field matches field requirements. I would like that the entered valued be displayed in the field, instead of it being blank. here's what i came up with, but it doesn't appear to work as expected...
public void validateId(FacesContext context, UIComponent component, Object value)
{
String id = (String)value;
if (!(id.length() == 0 || id.length() == 9))
{
((UIInput)component).setValid(false);
FacesMessage message = new FacesMessage();
message.setDetail("Invalid");
message.setSummary("Invalid");
context.addMessage("popup", message);
((UIInput)component).setValue(id);
}
}
And in my JSF page...
<t:inputText id="tid" value="#{tid.id}" rendered="#{empty tid.id}"
autocomplete="off" validator="#{accessBacking.validateId}"></t:inputText>
What am i missing here?