Solved

asp to asp semaphores

Posted on 2007-04-02
7
333 Views
Last Modified: 2008-02-07
Scenario…

Main program (asp A with Javascript and VBscript code) contains a form with dropdown to enable a user to select an item from the dropdown  to perform a utility function (back up a file).  Asp A using a javascript function changes HTML in a <div> to: “Your backup is in progress” and then does a window.open to the backup page (asp B).  Asp A stays open and visible as asp B is opened in a smaller window on top of asp A.

Asp B (with Javascript and VBscript code) performs the backup function and when done writes a <table>...</table> with an <a href=...">close window</a>.  When the user clicks the link the code should change the asp A <div> HTML to: “Your backup has been completed successfully” and then do a window.close.

The backup function works fine and the window.close works fine but I am having trouble getting asp B to change the <div> value (on asp A).  I have tried several approaches and also have done some research to check out others’ approaches—most are rather involved.

Any suggestions?

Thanks.
0
Comment
Question by:dklauk
  • 3
  • 2
  • 2
7 Comments
 
LVL 22

Expert Comment

by:WMIF
ID: 18839387
can you explain what you have tried already?  you should be able to do this with a simple javascript function, but i am not sure if you have tried this already.  here is some code from a working app that i did a while ago which opens a small window for a list of values.  the user selects the value by clicking, which triggers this function.  this function assigns the value to a form field on the main page, then sets the focus back there and closes the small window.

<script language="JavaScript" type="text/JavaScript">
function pickClose(selRte) {
      self.opener.document.formCICM.txtChain.value = selRte
      self.opener.focus()
      window.close()
}
</script>
0
 

Author Comment

by:dklauk
ID: 18839669
It looks like what you have done is what I want to accomplish.  And, I did not include the 'self.opener' in the javascript I use.

However, when I use the 'self.opener.document.formname.pagediv.value = "<p>success.</p>" I get an error indicating that the 'self.opener.document.formname.pagediv.value' is null or not an object.



0
 
LVL 22

Expert Comment

by:WMIF
ID: 18839688
try doing 'self.opener.document.getElementById("nameOfDiv")' with correct letter case.
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
LVL 63

Expert Comment

by:Zvonko
ID: 18839698
Because of reload of html content in popup asp B does the popup loose the reference to its opener.
To get back the reference to opener does the opener need to have a window name.
Therefore you need to set the name on asp A.
Like this:
<script>
window.name="aspWinA";
window.open("windowb.asp");
</script>

Now that winaow for asp a has a name you can change the div innerHTM on asp A like this:
<script>
function finishAndClose(){
  var winA = window.open("",="aspWinA","top=90000,left=90000");
  winA.document.getElementById("yourDivID").innerHTML = "Job done.";
  winA.focus();
  self.close();
}
</script>

0
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 18839708
Sorry, typo.
Take this:

<script>
function finishAndClose(){
  var winA = window.open("","aspWinA","top=90000,left=90000");
  winA.document.getElementById("yourDivID").innerHTML = "Job done.";
  winA.focus();
  self.close();
}
</script>


0
 

Author Comment

by:dklauk
ID: 18839995
Zvonko...

Your solution worked exactly as needed!  Thanks.
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 18841950
You are welcome.
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

803 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