0

对于注册表单,我有一些简单的东西,例如:

        <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" />

包括最后两行时,我收到两条关于验证错误的消息。省略最后一行时,会出现一个 javascript 警报,这不是我想要的。

是否有解决方案以某种方式仅显示一条验证失败消息?

非常感谢!

4

2 回答 2

1

问题是,字段必须水平布局。将 ZIP 字段和城市不相邻放在一条线上是不行的。至少对我来说。

一位同事指示我在第一个 tr:message 中设置一个 faclets 变量,并在第二个对该变量作出反应的属性上放置一个渲染属性。还没有时间尝试也没有找到设置变量的正确命令。将尽快公布结果。

于 2008-09-20T13:19:32.070 回答
0

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.

于 2008-09-20T10:16:31.947 回答