myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Gillan <>
Subject [Sandbox] ajaxChildComboBox apparently not calling validator
Date Tue, 20 Feb 2007 16:31:33 GMT


I'm using the ajaxChildComboBox (great component by the way - thanks very
much) and need to validate that the user has chosen a value. The business
logic requires that the first selection be a blank (e.g. no value) so that
the user must go through the motions of choosing an option. For some reason,
having a select option with value = "" or null doesn't work (possible dojo
issue?) so I cannot use the required flag. I've decided to set the first
select item's value to be "-", and then write a validator to ensure that the
submitted value is something other than "-". Here's the code from the jsf

<s:ajaxChildComboBox id="division" value="#{organizationData.division}"
   <f:selectItems value="#{organizationData.divisions}"/>	

and here's the validator code:

    public void validateDropdown(FacesContext context, UIComponent
component, Object value)
    throws ValidatorException {  
        log.trace("Executing validator for component: " +
        String input = (String)value;
        if ("-".equals(input) || input == null) {
            log.debug("Validation error for component: " +
            FacesMessage message =
Messages.getMessage(MESSAGES_BUNDLE,"app_dropdownValidation", null);
            throw new ValidatorException(message);

However, watching the code with the debugger and watching the logs, the
validator doesn't get called, and page validation completes successfully. It
seems like ajaxChildComboBox is not calling the specified validator, is this
possible? (Or have I done something wrong?)

Thanks in advance,
Mike Gillan

View this message in context:
Sent from the MyFaces - Users mailing list archive at

View raw message