Search code examples
jsftrinidad

How to change tr:message style


I am using tr:inputText reqired=”true” In order to validate an empty field.

In the Trinidad Demo I can see that the tr:message is in red

I try to use the same skin from Trinidad demo and also via inlineStyle but I can still see the message in black.

  xmlns:h="http://java.sun.com/jsf/html"
  xmlns:tr="http://myfaces.apache.org/trinidad"
  xmlns:f="http://java.sun.com/jsf/core">
<tr:document>
    <tr:panelFormLayout>
        <tr:form>
            <tr:inputText id="it"
                          required="true">
                <f:facet name="help">
                    <tr:outputFormatted value="mail address"/>
                </f:facet>
            </tr:inputText> 
            <tr:commandButton text="submit"/>
            <tr:message for="it" inlineStyle="background-color:red; border: 1px solid #BBB1AA"/>
        </tr:form>
    </tr:panelFormLayout>
</tr:document>

Maybe someone know how can I change the message style

Thanks


Solution

  • put this in your trinidad-skinning.css file:

    .AFComponentMessageCell
    {
        background-color: red;
        color:blue;
    }
    

    the tr:message tag is for messages, you put into FacesContext like this

    FacesContext facesContext = FacesContext.getCurrentInstance();
    FacesMessage msg = new FacesMessage();
    facesContext.addMessage( "id_of_component", msg );