Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Multiple windows - clearing html:errors on parent window

 
Jane Shields
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a JSP report search page which displays error messages for missing mandatory fields using html:errors properties.

If a user gets these errors then performs a successful search, they get an excel results page in a new window with the content type for the page as "application/vnd.ms-excel".


The problem is that the 'parent' report search page still displays the errors. The action class sends it's response to the new window so the original page is not refreshed. I need to display the search criteria on the original page but remove the errors when a user performs a successful search.

I cannot see how to do this.
1. I thought of calling a JavaScript function when the getReport button was pressed to clear the errors. But the html:errors are Struts components so cant be altered on the client side....

2. From the server side, the action class can only send one response which we currently send to the results window. I cannot refresh/rebuild the search page AND forward to the results page.


If I'm missing something obvious, please help......
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can remove the messages with javascript by using the the Document Object Model (DOM). There is a removeChild() method that you can execute from any node. All you have to do is get a reference to the part of the page that is showing the message (table? Unordered list?), find it's immediate parent, and execute the removeChild() method.

Another way to do it would be to hide the message without actually removing it. If you're not familiar with the DOM, here's a link that will get you started:

http://www.javascriptkit.com/javatutors/dom.shtml
[ June 08, 2006: Message edited by: Merrill Higginson ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic