Heath Borders wrote:

This is a known issue with the JSF spec. The spec says that for any UIInput if the submittedValue is null, validation should not be called. There's nothing that we can do about it if we want to remain standards compliant.

then suppose I have a value that I should handle throughtout the whole application but cannot use sessions for this (for example a selected id of a newsitem in a editor)
then if use the 'required' attribute I cannot retrieve it as the model updating phase comes after the validating one.
But if I use my own validator I can get this variable and validate the field value as I want(including if was empty or not)


On Apr 8, 2005 9:59 AM, *Borja Martín* <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> wrote:

    hi,
    I have seen that my own validator method isnt called when the field
    value is empty(I'm making this to be able to get some sent form values
    during the validation). I have this:

    ...
    <h:inputText id="title" value="#{news.title}"
    validator="#{news.validateTitle}" />
    <h:message for="title" />
    ...

    and in the NewsForm class:
    ...
    public void validateTitle(FacesContext context, UIComponent comp,
    Object
    obj)
    {
       throw new ValidatorException(
               new FacesMessage("just testing the method is called"));
    }

    as you can see the method should send the a validatorexception
    whenever
    the form is sent(just for testing purposes). well, if the field is
    totally blank it isnt called, but when it contains at least one
    character it is.

    Maybe that has something to do with what we talked before about that
    previously blank fields where handled as empty strings and now as null
    values...

    thanks in advance




--
-Heath Borders-Wing
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>




Reply via email to