l i n u x - u s e r s - g r o u p - o f - d a v i s
Next Meeting:
July 7: Social gathering
Next Installfest:
Latest News:
Jun. 14: June LUGOD meeting cancelled
Page last updated:
2004 Sep 11 12:00

The following is an archive of a post made to our 'vox-tech mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox-tech] [OT] JavaScript / HTML Help: Popup windows and forms
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox-tech] [OT] JavaScript / HTML Help: Popup windows and forms

On Saturday 11 September 2004 02:04 am, Mark K. Kim wrote:
> You can use Javascript to open up a popup window from the main window.
> The popup window can close itself with Javascript (using the "onSubmit="
> attribute I think).  Those are simple enough.

Closing the window in an onsubmit() handler seems untidy.
For example this precludes the script which receives the
form from returning an error message.

What I do is have the server-side script write a block of
JavaScript which in turn closes the window.  Here's a PHP
snippet that may offer some ideas:

<script LANGUAGE="JavaScript">
  if ($errmsg) {
    echo "window.alert('$errmsg')\n";
    echo "window.back()\n"; // redisplay the form
  } else {
    echo "opener.document.forms[0].submit()\n";
    echo "window.close()\n";

-- Rod
vox-tech mailing list

LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
O'Reilly and Associates
For numerous book donations.