I know this is an old thread, but I ran into the same problem with the ValidatorException
causing the crash. After much trial and error, this is the solution I have come up with. I
thought it may be useful for others, at least once I get the last little niggle out of it,
which I don't think is relevant to the problem at hand.
At the bottom of my form, I create a hidden input field, with a dummy value and a bound
validator method. In this method, I then get the components I'm interested in and
validate the values. If a field is deemed invalid, the flag it as such and add a message
to the context. E.g.
| public void validateForm(FacesContext context, UIComponent component, Object
value) throws ValidatorException {
| HtmlInputText theInputText = (HtmlInputText)
context.getViewRoot().findComponent("myForm:myInputId");
| String theValue = (String) faxInputText.getValue();
| if ("anError".equals(theValue)) {
| theInputText.setValid(false);
| context.addMessage(theInputText.getClientId(context),
FacesMessages.createFacesMessage(FacesMessage.SEVERITY_ERROR, "This is an
error!"));
| }
| }
|
|
My only problem left is that sometimes, for some reason, the method does not get called.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025041#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...