HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old October 12th, 2003, 09:51 PM
icepricessa's Avatar
icepricessa icepricessa is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Posts: 183 icepricessa User rank is Private First Class (20 - 50 Reputation Level)icepricessa User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 16 h 57 m 22 sec
Reputation Power: 6
Red face refreshing the parent window when a popup closes using javascript

hi there I was wondering if it's possible when the popup window loses, the parent window refreshes the form but leaves the entered data previously intact?? I'm not too sure on how to do it. could anyone give some tips or ideas? thanks =)
thanks in advance

Reply With Quote
  #2  
Old December 3rd, 2003, 03:25 AM
dev257 dev257 is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Location: Chandigarh
Posts: 55 dev257 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 48 sec
Reputation Power: 5
i think you will need to use cookies for that

Reply With Quote
  #3  
Old December 5th, 2003, 11:19 AM
frankcow's Avatar
frankcow frankcow is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: http://www.justin-cook.com
Posts: 133 frankcow User rank is Private First Class (20 - 50 Reputation Level)frankcow User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 h 34 m 16 sec
Reputation Power: 5
if you are using asp or some other server side technology, you could just have the form submitted to the same page, and populate the fields by picking up the request.form elements

or, perhaps, on the pop up window, you could do an onLoad() and an onUnLoad() function for the body

something like:

var o = window.opener;
var f = o.document.forms[0];
var arFields = new Array()

function retrieveFields() {
for ( var i = 0; i < f.elements.length; i++ ) {
arFields[i] = f.elements[i].value;
}
}

function refreshPopulate( ) {

o.location.reload()
for ( var i = 0; i < arFields.length; i++ ) {
f.elements[i].value = arFields[i]
}
}

you'll have to modify it to handle non-text input fields

Reply With Quote
  #4  
Old July 21st, 2004, 03:52 PM
brynhood brynhood is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Location: Belgium,Ghent
Posts: 1 brynhood User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
problem oriented implementation

I have used a part of this code in my solution to refresh some option boxes generated from database values.

I have a reload button in a form and data in another form. When I click the reload button a new window appeares and saves all the text and selected options from one options box. After that it refreshes the parent form and closes itself after 1 second. On closing it restores the values back to the form.

I changed the location of the reload request. So that the page is properly loaded before we access any functions and properties. Otherwise you get an error in IE about nonexisting properties and functions.

<script language="JavaScript">
var o = window.opener;
var f = o.document.forms[0];
var arFields = new Array()
var selectedText=new Array();
var selectedValues=new Array();

function retrieveFields() {
for ( var i = 0; i < f.elements.length; i++ ) {
switch(f.elements[i].type){
case "text" :
arFields[i] = f.elements[i].value;
break;
case "textarea":
arFields[i] = f.elements[i].value;
case "select-multiple" :
if(f.elements[i].name=="list2"){
for(j=0;j<f.elements[i].length;j++){
selectedText[j]=f.elements[i].options[j].text;
selectedValues[j]=f.elements[i].options[j].value;
}
}
break;
case "hidden" :
arFields[i] = f.elements[i].value;
break;
}
}
var o=window.opener;
o.location.reload();
}

function refreshPopulate( ) {
var f = o.document.forms[0];
//alert("after reload call " + o.name);
for ( var i = 0; i < arFields.length; i++ ) {
switch(f.elements[i].type){
case "text" :
f.elements[i].value = arFields[i];
break;
case "textarea":
f.elements[i].value = arFields[i];
case "select-multiple" :
//just do nohting, use AddOptionToList of main page
break;
case "select-single":
break;
case "hidden":
f.elements[i].value = arFields[i];
break;
}
}
//add options back to the list
for(i=0;i<selectedText.length;i++){
o.AddOptionToList(f.list2,selectedText[i],selectedValues[i]);
}
}
</script>
<body onLoad="retrieveFields();setTimeout(window.close, 1000)" onUnload="refreshPopulate()">

<h1>Page is reloading</h1>
<p>just wait a second or <a href="javascript:window.close()">close this page</a> </p>
</body>
</html>

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > refreshing the parent window when a popup closes using javascript


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT