Solved

Popup window and history.back

Posted on 2004-04-07
6
883 Views
Last Modified: 2012-08-14
I have a JSP page page1.jsp which posts on another JSP page page2.jsp,
On page1.jsp there is a button that opens a popup window, when user submits page1 he can view a summary on page2 and can click back to change information, back is history.back, when he goes to page1.jsp all the data is there, unless he has clicked on the button to open the popup window on page 1 in this case when he clicks on back the data is gone
0
Comment
Question by:ko78
  • 2
6 Comments
 
LVL 7

Expert Comment

by:TheKenman
ID: 10773359
Hi ko78,

Can I see a sample of your code?

Thanks.
0
 

Author Comment

by:ko78
ID: 10773484
<Script      language="javascript">
function drawbutton(name,link){
      document.write("<table cellpadding=0 cellspacing=0 class=button height=16><tr><td width='4' background='/PMResources/images/en/itworx/hedge2/btn_left.gif'></td><td nowrap background='/PMResources/images/en/itworx/hedge2/btn_middle.gif'><a class=button href='"+link+"'>"+name+"</td><td width=5 background='/PMResources/images/en/itworx/hedge2/btn_right.gif'></td></tr></table>");
}
function SearchForUser(){
      var features = 'top=0,left=0,width=480,height=300,toolbar=no, menubar=no, scrollbars=no, resizable=yes,location=no, directories=no, status=no'
      var url = "/NASApp/pae/Loan_Request.npm?eventId=Itworx.SearchFieldUIEventHandler&__FieldName=SearchByName&__NodeName=Saved&boxValue=" + document.forms[0].SearchByName.value + "&__rand=" + (new Date()).getTime()
      var w = window.open(url,'FX_Search',features);
      w.focus();
}
</Script>


And this is written in the HTML
<td>
<script language="javascript">
drawbutton('SEARCH','javascript:SearchForUser()')
</script>
</td>

and the back button in page2 is

<td>
<script      language = "javascript">                                    
drawbutton("BACK","javascript:window.history.back();")
</script>
</td>
0
 
LVL 4

Accepted Solution

by:
tenacium earned 200 total points
ID: 10778580
My recommendation is when you click "change information", don't send them a browser "back" command.  Instead, bring them to JSP1 again and pass all the information again pre-populated.  It's much more reliable and improves user experience.  Since you pass the information from JSP1 to JSP2, I assume you know how to do it and it won't be that difficult to implement.  It's difficult to know what end-users are doing with their browsers and how that may affect your back button command.
0
 
LVL 7

Expert Comment

by:TheKenman
ID: 10778628
I agree.

When the pop-up is opened it takes the place of the 1st page in the browser history. Working around this would be much harder - and more likely to fail - than implementing data persistence.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Read about why website design really matters in today's demanding market.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…

840 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question