views:

833

answers:

2

Hi,

For a registration form I have something simple like:

  <tr:panelLabelAndMessage
   label="Zip/City"
   showRequired="true">
   <tr:inputText 
    id="zip"
    value="#{data['registration'].zipCode}" 
    contentStyle="width:36px"
    simple="true"
    required="true" />
   <tr:inputText 
    id="city"
    value="#{data['registration'].city}" 
    contentStyle="width:133px"
    simple="true"
    required="true" />
  </tr:panelLabelAndMessage>
  <tr:message for="zip" />
  <tr:message for="city" />

When including the last two lines, I get two messages on validation error. When ommiting last to lines, a javascript alert shows up, which is not what I want.

Is there a solution to show only one validation failed message somehow?

Thanks a lot!

A: 

I know this won't be ideal, but if you remove the 'panelLabelAndMessage' tag and just use the label attribute on the 'inputText' tag that should remove the extra error message. I have a similar problem on something I'm working on at work, if I find a better solution I'll post it.

+1  A: 

Problem is, the fields must layout horizontally. It's a no-go to put ZIP field and city not next to each other in one line. At least for me.

A co-worker has pointed me to set a faclets variable inside the first tr:message and to put a rendered attribute at the second one that reacts on this variable. Havn't got the time to try nor found the right command for setting a varable yet. Will post results as soon as possible.

GHad