Configuring Seam validation messages
[Logo]
ICEsoft.org Forums: ICEfaces, ICEmobile, ICEpdf
[Search] Search   [Recent Topics] Recent Topics   [Groups] Home Page | www.icefaces.org  [Register] Register  [Login] Login 
Configuring Seam validation messages  XML
Forum Index -> JBoss Seam Integration
Author Message
laura.vigna


Joined: 31/08/2009 00:00:00
Messages: 30
Offline


Hi guys
I have a problem. I use ICEfaces with seam (hibernate) Validators in my beans, they work smoothly. They even get localized, everything ok.
BUT, I don't wanna display the name of the field in the validation message!!!! For example I get the following error message if a required input field is left empty:

sidebarPanel:decorateTinSingleDoc:selectTinInput : il valore è obbligatorio!

But I just wanna display this:

il valore è obbligatorio!

How can I configure it????

Here is my decorator around the input field:

<s:decorate id="decorateZA" template="../content/error.xhtml" >

My error.xhtml is quite standard anyway I post it:

<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:s="http://jboss.com/products/seam/taglib">

<div class="entry">
<s:label styleClass="label #{invalid?'errors':''}">
<ui:insert name="label"/>
<s:span styleClass="required" rendered="#{required}">*</s:span>
</s:label>
<span class="input #{invalid?'errors':''}">
<s:validateAll>
<ui:insert/>
</s:validateAll>
</span>
<s:message showSummary="false" id="message" style="color: red"/>
</div>

</ui:composition>


Thanks!!!


Laura

"Fatti non foste a viver come bruti, ma a seguir virtute e conoscenza"
judy.guglielmin

Joined: 20/02/2007 00:00:00
Messages: 1196
Offline


You can either edit your template to set a conerterMessage property on each component or you can override the message bundle resrouce that specifies the message format. Same techniques apply for validatorMessage

Here is a link to the Hibernate docs with more background (since Seam is tight with Hibernate) on validation using Seam and Hibernate:-
http://docs.jboss.org/hibernate/validator/3.x/reference/en/html_single/#validator-checkconstraints-db

You can place a converterMessage or validatorMessage on any of our ice input components

Here is a link on using validatorMessages with Seam:-
http://seamframework.org/Community/CustomSetOfMessagesForHibernateValidatorAnnotations
laura.vigna


Joined: 31/08/2009 00:00:00
Messages: 30
Offline


Hallo Judy
the first link doesn't work :D but thanks for your reply.
I don't wanna specify every single message in my bundle files, that's exactly what i don't wanna do because the messages are ok I don't wanna rewrite them all (I would also have to translate them in 3 languages!! they get translated automatically by the framework)

The required fields are not annotated on the bean, they are just marked on the gui (xhtml files) as Required

<ice:inputText id="myInput" value="#{belegeSearchMask.tin}" required="true"/>

I don't wanna change the message I just don't wanna show that rubbish...sorry but who would wanna show the error message that way:

nameOfMyPanel:nameOfMyForm:nameOfMyField: errorMessage

Why is it automatically so in the framework or do I do something wrong? I mean it doesn't make any sense to me.


Thanks in advance for any help

Laura

"Fatti non foste a viver come bruti, ma a seguir virtute e conoscenza"
 
Forum Index -> JBoss Seam Integration
Go to:   
Powered by JForum 2.1.7ice © JForum Team