This content has been marked as final.
Show 5 replies
-
1. Re: 2 Questions regarding rich:message for tables and how to
nille Sep 9, 2009 1:27 AM (in response to nille)*Bump*
Does no one has a clue?
Kind Regards,
nille -
2. Re: 2 Questions regarding rich:message for tables and how to
liuliu Sep 9, 2009 3:44 AM (in response to nille)
1) i think you cant do it for a table. table is not the component who send the message.
2)Using ajaxkey, just rerender this 2 tables, set the rows you want in the ajaxkey of 2 table.
hope this can help you. -
3. Re: 2 Questions regarding rich:message for tables and how to
nille Sep 10, 2009 4:39 AM (in response to nille)Hi,
thanks for your reply. I'll check 2) asap.
Thanks again.
Kind Regards,
nille -
4. Re: 2 Questions regarding rich:message for tables and how to
nille Sep 11, 2009 7:21 AM (in response to nille)Hi,
so, thanks for your hint regarding my question no.2. I did not realize, that one can specify the id in a more detailed way than just the name used for the 'id' attribute. With<a4j:commandLink...reRender=":testForm:tab1:col2,:testForm:tab2:col2,:testForm:tab1:col3,:testForm:tab2:col3"/>
it just works. =).
As for question no. 1 I have no solution yet.
Kind Regards,
nille -
5. Re: 2 Questions regarding rich:message for tables and how to
nille Sep 14, 2009 3:40 AM (in response to nille)I worked around the other problem by using a custom validator, writing the validation message into a field, which ID is passed as a child of the parent input field. Not a good solution, but I have no other idea.
import javax.faces.application.FacesMessage; import javax.faces.component.UIComponent; import javax.faces.context.FacesContext; import javax.faces.validator.Validator; public class TestValidator implements Validator { @Override public void validate(FacesContext arg0, UIComponent arg1, Object arg2) { int myVal = (Integer)arg2; //Id of an not rendered input field; used in the 'for' attribute of the 'message' tag Object ret = arg1.getAttributes().get("target"); if(myVal < 0) { FacesMessage myMsg = new FacesMessage(); myMsg.setSeverity(FacesMessage.SEVERITY_WARN); myMsg.setDetail("Detail comin' here"); myMsg.setSummary("Summary goes here"); if(ret != null && ret instanceof String) { String target = (String)ret; javax.faces.context.FacesContext.getCurrentInstance().addMessage(target, myMsg); } } } }
The usage in the xhtml page:... <rich:messages for="testForm:myMsgField"/> ... <h:inputText id="myMsgField" value="#{remoteTestClass.testField}"> <a4j:support event="onchange" ajaxSingle="true" action="#{remoteTestClass.test2()}"/> <f:validator validatorId="test.TestValidator"/> <f:attribute name="target" value="testForm:myMsgField"/> </h:inputText> ... <h:inputText id="myMsgField" rendered="false"/>
Not shown here the configuration in 'faces-config.xml'
If anyone has a better idea I would really appreciate it. The above 'solution' is not really a solution.
Kind regards,
nille