[Javascript] Closing pop-up window on form submit

Lau lau at goldenweb.com.au
Tue Sep 25 19:56:38 CDT 2001


Looks okay to me.
Try changing your button type to BUTTON rather than SUBMIT and see if that makes a difference.
If that don't work I would make an absolutely basic page that has nothing else on it other than the
form one field and a button with document.myFormname.submit(); nothing else and see if that works...
maybe its something else interfering with the process.

I've never used  enctype="multipart/form-data" ... no idea what that does... try removing it and see
if it makes a difference.

The following shouldn't make a difference but you may want to try it if all else fails:
I don't put my onclick code in the button tag... I put a put it in a link around an image <A
Href='Javascript: void document.myFormname.submit(); opener.location.href='/main_page.jsp';
self.close()'><IMG SRC='jsdfsh'></A>

That way I can have pretty buttons instead of ugly grey buttons and the user will see the "hand"
when they place the cursor over the button. You don't have to use an image could just have the
standard grey button with a link around it.


Basically my approach when facing such problems is to simplify the problem down until I can get
something working ... then I add extra bits of code one step at a time until it stops working.


Peace
Lau

----- Original Message -----
From: Jay Wright <jwright at once.com>
To: <javascript at LaTech.edu>
Sent: Wednesday, September 26, 2001 7:34 AM
Subject: RE: [Javascript] Closing pop-up window on form submit


>
> hmmm.  something still doesn't work.  when i open a new window, i give it
> the name "childWindow".  the form is named "formname".
>
> none of the following work:
> document.formname.submit();
> self.formname.submit();
> childWindow.formname.submit();
>
> what am I missing?  i'm sure it's something obvious
>
> <form name="formname" action="/content_upload.jsp" method="post"
> enctype="multipart/form-data">
> <input type="text" name="data"><br/>
> <input type="submit" name="submit" value="Finish"
> onClick="self.formname.submit();opener.location.href='/main_page.jsp';self.c
> lose()"><br>
> </form>
>
> > -----Original Message-----
> > From: Lau [mailto:lau at goldenweb.com.au]
> > Sent: Tuesday, September 25, 2001 5:40 AM
> > To: javascript at LaTech.edu
> > Subject: Re: [Javascript] Closing pop-up window on form submit
> >
> >
> > Instead of using a button of TYPE=SUBMIT just use TYPE=BUTTON
> > then
> > onclick=document.myFormname.submit();opener.location.href='/ma
> > in_page.jsp';self.close()
> >
> >
> > Peace
> > Lau
> >
> > > ----- Original Message -----
> > > From: "Jay Wright" <jwright at once.com>
> > > To: <javascript at LaTech.edu>
> > > Sent: Monday, September 24, 2001 3:56 PM
> > > Subject: [Javascript] Closing pop-up window on form submit
> > >
> > >
> > > >
> > > > I have created a small set of web pages, that will open a
> > pop-up window
> > > with
> > > > javascript, present the user a form, and then, on submit,
> > close the pop-up
> > > > window and reload the main site page.
> > > > Below is the form code that I am using. This works,
> > except, of course,
> > > that
> > > > the data is never POSTED to /content_upload.jsp. The
> > window closes and the
> > > > "opener" web page is reloaded with "/main_page.jsp", but
> > the data is never
> > > > processed.
> > > > What is the work around. Is there something I can do in
> > the form that will
> > > > allow the post to take place before closing the page. Or is there
> > > something
> > > > I can do in the /content_upload.jsp that would do the
> > processing and then
> > > > close the window?
> > > > Looking for a JavaScript guru to lend a little advice. Thanks,
> > > > Jay
> > > > -------------------------------------------------
> > > > PS. Yes, I do need enctype to be multipart, this form is
> > simplified, but
> > > > many of them load images.
> > > > <form action="/content_upload.jsp" method="post"
> > > > enctype="multipart/form-data">
> > > > <input type="text" name="data"><br/>
> > > > input type="submit" name="submit" value="Finish"
> > > > onClick="self.close();opener.location.href='/main_page.jsp'"><br>
> > > > </form>
> > > >
> > > >
> > > > _______________________________________________
> > > > Javascript mailing list
> > > > Javascript at LaTech.edu
> > > > http://www.LaTech.edu/mailman/listinfo/javascript
> > > >
> > >
> > > _______________________________________________
> > > Javascript mailing list
> > > Javascript at LaTech.edu
> > > http://www.LaTech.edu/mailman/listinfo/javascript
> > >
> > >
> >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > http://www.LaTech.edu/mailman/listinfo/javascript
> >
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> http://www.LaTech.edu/mailman/listinfo/javascript
>
>




More information about the Javascript mailing list