Robin Mannering wrote:
Hi,


Platorm is : Tomcat 5, Struts 1.1

Context: HTML Form submissions and validation.


I'm trying to conditionally test for the existince of error messages by their keys. And I'd then like to show the error with HTML formatting around it.


Basically, using tags, I'd like to do the same as the following following pseudo code.


if (errorMessage named 'usernameError' exists) {

        showError('usernameError' + some html)

}


The error message is set from within the Form class as:


errors.add("usernameError", new ActionError("errors.form.username.required"));


I've been trawling around and have found lots of references to <logic:messagesPresent> and then looping through each message using <html:messages> but not a test for the existence of a particular message.


I'm trying to display the error message next to each appropriate form element rather than in a list. I probably can't see the solution for looking. Can anyone help?


Many thanks

Robin

Read http://struts.apache.org/api/org/apache/struts/taglib/html/package-summary.html#doc.Other.errors,
paying attention to the property attribute of html:errors


-- Jeff

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to