• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Form mapping based on ActionErrors etc?

 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know of any struts tags or technique to automatically highlight or change font colro or focus a form tag based on the input of a ActionErrors object?
For example, if I have an text box named �foo� and my ActionError object returns an identifier �foo� I know want to highlight that field e.g. paint it red, place the cursor there etc?

Any ideas?

thanks
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could create javascript init() method and call it from the body's onload event. In that method, put something like the following:

<logic:messagesPresent property="foo">
document.myForm.foo.style.color = 'red';
document.myForm.foo.focus();
</logic:messagesPresent>
[ August 04, 2005: Message edited by: Merrill Higginson ]
 
Max Tomlinson
Ranch Hand
Posts: 365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Perfect-

thanks, Merrill-

Max
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic