l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
September 2: Social Gathering
Next Installfest:
TBD
Latest News:
Aug. 19: Siafoo slides and photos online
Page last updated:
2004 Sep 11 12:00
Events
 Meetings
 Installfests
 Demos
 Photos
Services
 Library
 LERT
 Jobs
 Documents
Interact
 Mailing Lists
 - Search
 - Archives
 Chat
About Us
 Members
 Projects
 Testimonials
 Call for Speakers
 Why Not MS?
 Finances
 Sponsors

^Home
?Search
?News & RSS
?Calendar
@Contact Us
$Buy Stuff
=Printable


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">
<?php
  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";
  }
?>
</script>

-- Rod
_______________________________________________
vox-tech mailing list
vox-tech@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox-tech



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

CD Burns Wanted!

LUGOD: Linux Users' Group of Davis
1105 Kennedy Place, Suite 1, Davis, CA 95616
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.