homepage Welcome to WebmasterWorld Guest from 54.226.180.86
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Visit PubCon.com
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Javascript, forms, opener.window help!
loss of information between opener and child windows
chesko




msg:1487555
 7:57 am on Sep 18, 2002 (gmt 0)

Hi everyone,
I would appreciate if someone could help me out with the following problem.
Actually Im developing a web application for my company using asp under IIS 5.0.
The page Im having trouble with has a form with different fields to fill out, a submit button and an image with href to a function which calls a child window to open (the child window is done thru the same opener page, so we never leave the opener window). I use the child window to select a value in a combobox to after pass that value to the opener window. The submit button of the opener form goes to a page which checks permission to submit the form, otherwise bringing you back to the same page(history.back()). So if I fill the fields in the opener window, submit the form, and for any reason brings me back to the page (since access was denied, and password has to be entered once again), all the data in the fields are as I previously left them, so no problem until then.
Although if I do the same operation, but before clicking on the submit button to go thru the check_access page I click on the popup window button, then after submiting the form, and returning to the page (because the check_access page denies me access) all the fields in the opener form are blank!

Thanks,

:: CHESKO ::

 

chesko




msg:1487556
 1:34 pm on Sep 18, 2002 (gmt 0)

Hi again,

I have found the following... the code that opens the popup is something like:

function listItems(temp){

// ..... more code goes here ....

mytext = mytext + "</ol><center><a href='javascript:self.close();'>close</a></center><BR>";
linkswin = window.open(window.location,'',windowprops);

// If I add this ALERT it works fine... why?
alert(self.name);

linkswin.focus();
linkswin.opener = window;
linkswin.opener.name = self.name;

mypopup= myheader + myfont + mytext + myendfont + myendheader;
with (linkswin.document) {
open();
write(mypopup);
close();
}
}
// end -->

Thanks so much...

joshie76




msg:1487557
 1:47 pm on Sep 18, 2002 (gmt 0)

Hi Chesko

Welcome to WebmasterWorld,

I'm a little baffled as to exactly what's going wrong for you but I just scanned your code and the following lines seem to me to be unnecessary...

linkswin.focus();
linkswin.opener = window;
linkswin.opener.name = self.name;

Since the linkswin window is being opened by the same script the linkswin.opener object should automatically be configured to point to the window running the script and therefore shouldn't need assigning to...

I tried the code and it worked fine without those lines. As I say, I'm not entirely clear what's going wrong.

Let me know if I'm wandering down the wrong track.

Josh

chesko




msg:1487558
 2:11 pm on Sep 18, 2002 (gmt 0)

Thanks Josh,

as you where pointing out, those lines where not needed. But even deleting those lines out of the code, I continue having the same problem.

- I fill the form (opener).
- Click on a button which calls the child window.
- Select a value which will go into a field in the opener form.
- The child window self closes.
- Click on the submit button (opener).
- A in-between page is called for password verification.
- If password no good then history.back() to opener with all fields with the data entered.

Supposedly, when history.back() the fields in the opener should remain as they were left (this is filled out with the same data).

If I do not call the child window prior to submitting the form then history.back() works fine, mantaining all data as it was.

If I call the child window, select the value, close the child, submit the form, and password no good, then as history.back() data is lost....

It would work, if in the child window I add an alert(something) in between the code, prior to document.write as stated in my second response... Seems like child window should completely load or something like that... :-?

Thanks again,
:: CHESKO ::

joshie76




msg:1487559
 4:18 pm on Sep 18, 2002 (gmt 0)

Hmm, complex but it sounds like the browser maybe misbehaving.

When a browser is entered into the history the form entries (with the exception) should also be stored so that when you go back the form was as you (or script even) left it.

What exactly is the child (opened) window doing with the form in the parent (opener) window?

Also...
- A in-between page is called for password verification.

How is this performed? Does the parent page POST to another page targetting itself (i.e. the parent window)?

If so have you considered posting to the same page that runs conditional code (if it's at the receiving end of the form post) that checks the validity of the password and if that fails repopulates the form fields on the server (therefore not relying on the browser's back) - this is the most common way this stuff is done.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved