File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes limit the width of error message Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "limit the width of error message" Watch "limit the width of error message" New topic

limit the width of error message

Armin Vetek

Joined: Aug 21, 2010
Posts: 29

I put two textfields on the struts2 form. I am using qxhtml theme - this is a custom theme, you could check It is similar to xhtml.

The form looks like below when I start to input the data:

I leave the value in textfield1 empty and I click the submit button. I get an error that textfield1 should not be empty. Label2 and textfield2 move right because error message belonging to textfield1 is displayed in one row and the length of errormessage in bigger then textfield1, also the textfield1 width increase. The form looks like below after the submit button is pressed:

I would like to fix the width of error message like below.

Is it possible to fix the errormessage width?

I think I should modify the row in controlheader-core.ftl:
<span class="errorMessage">${error?html}</span><#t/>

If I manually modify the row like in the example below, then it works. But I would like to get a dynamic width of textfield not fixed to 100px like in te statement below.
<span class="errorMessage" style="display: inline; width: 100px">${error?html}</span><#t/>

Best regards,
I agree. Here's the link:
subject: limit the width of error message
jQuery in Action, 3rd edition