While testing something else, I took a moment to check how Sun's Mojarra
handles required-messages. It also inserts the clientId (ie *with* the
form/subview prefix). Therefore myfaces 1.2.x and mojarra currently work
the same. I think it unlikely that MyFaces would accept a patch to
change its default behaviour to something different from Mojarra, although
(a) you could try; the decision is not mine to make, and
(b) you could create and offer a patch to make the behaviour configurable
Re the "label" attribute I mentioned below: it looks like JSF also added
this optional attribute to customise the {0} parameter, eg
<h:input id="someProgrammerId" label="someUserLabel" required="true"../>
will generate whatever generic "required" message is configured, but
with {0} set to "someUserLabel". This feature still requires setting
this on each component though.
Regards,
Simon
Simon Kitching schrieb:
> As I said earlier in this thread: set an explicit requiredMessage string.
>
> IMO, expecting component ids to be meaningful as part of error messages
> is wrong. They (a) are names chosen by a programmer for coding purposes
> not ui purposes, and (b) are not localisable. The default behaviour of
> inserting the id/clientId into the message should be just a last fallback.
>
> The code that actually handles this is
> UIInput.validateValue
> which invokes
> _MessageUtils.getLabel
> which returns component.getClientId by default.
>
> It is interesting that myfaces 1.1.x inserts just the component id by
> default, while myfaces 1.2 inserts the component clientId. Catagay
> Civici made these changes in r518079 and r518084 but there is no hint
> there why he made it use the full clientId instead of just id.
>
> Interestingly, _MessageUtils.getLabel (myfaces 1.2.x) does also look for
> an attribute or valueExpression called "label", and returns that if
> present. I wonder what that is for...
>
> Have you tried Sun Mojarra? If that outputs ids rather than client-ids
> then there is a reasonable chance that myfaces would be changed to
> match. But IMO it would *still* be wrong to rely on ids to create
> meaningful error messages for users.
>
> Regards,
> Simon
>
> j.palleschitz schrieb:
>
>> could someone tell me what the problem could be? please ;o)
>>
>> i get following message: contentView:Username: required field!
>>
>> and this looks not really nice.
>>
>>
>>
>>
>> j.palleschitz wrote:
>>
>>
>>> hi,
>>>
>>> now i have another problem like this.
>>> the id of the subview is rendered before den Message.
>>>
>>> any idea?
>>>
>>> thanks
>>>
>>>
>>>
>>
>>
>
>
>
--
-- Emails in "mixed" posting style will be ignored
-- (http://en.wikipedia.org/wiki/Posting_style)