Yes, ok you're right - sorry.
I didn't know, that you have to specify two different IDs:
--cut here--
FacesMessage lFM = getFacesMessage(FacesMessage.SEVERITY_ERROR, pMsgKey,
new Object[] {lShortFieldId});
getFacesContext().addMessage(pFieldId, lFM);
--cut here--
Where pShortFieldId is e.g. password
whereas pFieldId is registration:password.
Now, it works. Thanks.
regards,
Veit
Mike Kienenberger schrieb:
> Right, I understood you meant customized (programmically created)
> calls to addMessage.
> But that's the same thing that the validators do internally -- call
> addMessage.
>
> So if standard validation is working, perhaps the problem is that
> you've specified the wrong clientid value? (I find it easiest to bind
> the input to the backing bean and call input.getClientId(facesContext)
> to fetch the client id.
>
> Either that, or maybe your labels aren't set up properlly?
>
> This should be one of those "just works" situations.
>
> The code for printing out the label is handled in the t:message(s)
> component and should be independent of the message generation.
>
> On 1/17/06, Veit Guna <[EMAIL PROTECTED]> wrote:
>> Hi.
>>
>> No, I mean no std. Validation Error messages. These work fine.
>> I mean custom Messages that you add with
>> FacesContext.addMessage(ClientId, FacesMessage). This will be printed
>> "as-is" with no field label attached to it (as {0} or similar).
>>
>> I've used some workaround that is used internally by myfaces. Iterate
>> over all UIComponents on the page, find the OutputLabels, look at the
>> "for" Attribute and get its Component. If it's the label of the given
>> field, extract the label value - which is not very nice. All you get is
>> the EL expression - you have to parse and I18N it by yourself :(.
>>
>> But works for me.
>>
>> regards,
>> Veit
>>
>>
>> Mike Kienenberger schrieb:
>>> If you've set everything else up, it should be automatic:
>>>
>>> http://www.mail-archive.com/users%40myfaces.apache.org/msg15110.html
>>>
>>> On 1/16/06, Veit Guna <[EMAIL PROTECTED]> wrote:
>>>> Hi.
>>>>
>>>> How can I get the label (outputLabel) for a specific component? I need
>>>> this, to add the label text to a custom validation message. It seems
>>>> that {0} isn't filled automatically with the label when I add a custom
>>>> message with addMessage to the clientId (field).
>>>>
>>>> regards,
>>>> Veit
>>>>
>>>
>
>