myfaces-users mailing list archives

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

Hello,

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
page:

<s:ajaxChildComboBox id="division" value="#{organizationData.division}"
parentComboBox="ajaxSelectItemsMethod="#{organizationData.getDivisionsForSelectedCompany}"
validator="#{organizationData.validateDropdown}">
   <f:selectItems value="#{organizationData.divisions}"/>	
</s:ajaxChildComboBox>

and here's the validator code:

    public void validateDropdown(FacesContext context, UIComponent
component, Object value)
    throws ValidatorException {  
        log.trace("Executing validator for component: " +
component.getId());
        String input = (String)value;
        if ("-".equals(input) || input == null) {
            log.debug("Validation error for component: " +
component.getId());
            FacesMessage message =
Messages.getMessage(MESSAGES_BUNDLE,"app_dropdownValidation", null);
            message.setSeverity(FacesMessage.SEVERITY_ERROR);
            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: http://www.nabble.com/-Sandbox--ajaxChildComboBox-apparently-not-calling-validator-tf3261608.html#a9065157
Sent from the MyFaces - Users mailing list archive at Nabble.com.


Mime
View raw message