Hey,
I'm using JSF 1.1, not by choice.
I've written a custom validator to validate a certain number sequence which
is in predetermined format. It works but only if something is written in
the field. The field is required so a null value chould also output a
validation message.
I know from JSF 1.2 it's possible to use requiredMessage = "<message>" but
that's pretty much out of the question.
Googling around I found an implementation to override the standard method:
validate(FacesContext)
It roughly goes like this:
public class JsfNullValidator extends UIInput {
public void validate(FacesContext facesContext)
{
Object submitValue = getSubmittedValue();
if((submitValue == null) || (submitValue instanceof String) &&
((String)submitValue).length() < 1)
{
Validator[] validators = getValidators();
for(int i = 0; i<validators.length;i++)
{
Validator validator = validators[i];
if(validator instanceof JsfRijksRegisternrVerifier) //todo
dynamic solution
{
validator.validate(facesContext,this,null);
}
else {
super.validate(facesContext);
}
}
}
}
}
And now the Q..
I'm unsure where I need to override/extend the configuration so that the
standard <h:textField> uses this validate method instead of the standard
that doesn't use a validator when the input value is null.
Thanks in advance :)
--
View this message in context: http://www.nabble.com/JSF-1.1-null-value-not-entering-custom-Validator-tp20682073p20682073.html
Sent from the javaserverfaces users mailing list archive at Nabble.com.