Error handling
Hello,
I have a question concerning the error handling. I have a site with input fields. Furthermore I want to show all validation errors at the top of the site. This is not the problem, but additionally to the messages at the top I want to mark the input fields, e.g. with an asterix, which are invalid. I tried a lot but I don't know how to identifiy the error input field. For example
<h:form id="formId">
<h:outputText style="color:red" value="${my:errorAvailable('formId:lastname_id')}">Last name</h:outputText>
<h:inputText id="lastname" value="${person.lastName}" validator="${person.checkLastname}" required="true" />
</h:form>
The static function 'errorAvailable' should check if there exists an error message regarding to the lastname input field. Thereto I iterate over the error messages stored in the faces context and compare the ids. If an error has been found the method returns the asterix string. If no error has been found the empty string will be returned.
The problem is, that the function 'errorAvailable' has to know the exact id to verify if the facesContext contains an error message with this id this means not only 'lastname_id' but 'formId:lastName_id'. In the example above I specified this id but if the structure of the site changes, the id is invalid. How can I get dynamic access to this id or how can I handle this in another way? Please give me some inspiration ...
Best regards,
Ulrich Frank

