-
1. Re: trouble with <rich:inplaceInput> validator message
ilya_shaikovsky Sep 1, 2010 6:51 AM (in response to akshayjain7983)according to API docs
/*** <p>Append a {@link javax.faces.application.FacesMessage} to the set of messages associated with* the specified client identifier, if <code>clientId</code> is* not <code>null</code>. If <code>clientId</code> is <code>null</code>,* this {@link javax.faces.application.FacesMessage} is assumed to not be associated with any* specific component instance.</p>** @param clientId The client identifier with which this message is* associated (if any)* @param message The message to be appended** @throws IllegalStateException if this method is called after* this instance has been released* @throws NullPointerException if <code>message</code>* is <code>null</code>*/public abstract void addMessage(String clientId, FacesMessage message);you should use clientId.
so use like:
public void validateUserId(javax.faces.context.FacesContext context, javax.faces.component.UIComponent comp, Object value) { System.out.println(context); System.out.println(comp); System.out.println(value); context.addMessage(component.getClientId(context), new FacesMessage(FacesMessage.SEVERITY_ERROR,"Invalid","Invalid")); }
-
2. Re: trouble with <rich:inplaceInput> validator message
akshayjain7983 Sep 1, 2010 12:08 PM (in response to ilya_shaikovsky)Ok this solves the problem. But now I face another very peculiar problem. As shown above in code the validator is applied to a inplaceInput. So what is happening is this:
1. Load page.
2. Click on inplaceInput and type something (say '123' )
3. Tab out of control
4. No Message
5. Click on inplaceInput once again and type something diferrent (say '456' )
6. Tab out
7. Message displayed
That is when page is loaded first time and inplaceInput recieves and loses focus first time the validation does not occur at all because no output on console as per validation method that i shown above.
below is console output upon first tab out:
01-Sep-2010 21:33:05 org.slf4j.impl.JCLLoggerAdapter info
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.upon second tab out the output is as follows:
org.springframework.faces.webflow.FlowFacesContext@1e95e9e
org.richfaces.component.html.HtmlInplaceInput@430322
123
01-Sep-2010 21:34:00 com.sun.faces.lifecycle.RenderResponsePhase execute
INFO: WARNING: FacesMessage(s) have been enqueued, but may not have been displayed.that is when it is second time tab out then it does validation for first value.
Why?? What is wrong??
-
3. Re: trouble with <rich:inplaceInput> validator message
ilya_shaikovsky Sep 6, 2010 11:10 AM (in response to akshayjain7983)use not onblur but onviewactivated event. and check this thread to get code which will help to optimize number of calls.