Search the web
Sign In
New User? Sign Up
Perl_Official · Perl . CGI . Shell script
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Submit a form without leaving the page   Message List  
Reply | Forward Message #2055 of 2062 |
Re: Submit a form without leaving the page

Andy,

I think the best way to accomplish what you're trying to do is to
use AJAX. AJAX allows you to use JavaScript to issue an HTTP POST
or GET without reloading the page. There's a perl module that makes
this (relatively) easy to do at http://search.cpan.org/~bct/CGI-Ajax-
0.701/lib/CGI/Ajax.pm. The module includes several examples to get
you started. If you're trying to anything very complicated, you'll
need to read up on HTML, CGI, Javascript, and (less critically) XML.

I'd recommend three books from O'Reilly and Associates (www.ora.com):
* Programming Perl
* JavaScript: the Definitive Guide 5th edition or later
* CGI Programming with Perl

The JavaScript book contains a whole chapter about AJAX that I found
quite helpful.

AJAX introduces significant additional complexity to your project --
particularly if you haven't dealt with JavaScript much before. It
might be easier to rethink the way your application works and decide
if four independent forms on one page is worth the effort.

Darren

--- In Perl_Official@yahoogroups.com, "Andy Schafer"
<lostgameparts@...> wrote:
>
> Hi,
>
> I'm pretty new to Perl and need some help!
>
> I am working on a project that requires 4 forms on the same page. I
> would like to be able to submit each one separately but if the user
> has entered information in any of the other 3, that information
will
> be lost. (I think, and please correct me if I'm wrong!)
>
> What I'm wondering is this: Is there a way to submit a form to the
CGI
> script without actually leaving the page the form is on?
>
> I thought about using iFrames for each form but really don't like
that
> idea. I could also use one submit button for all 4 forms but I
don't
> like that either.
>
> I've hunted through all my books and on the net with no luck. I
know
> I'm probably overlooking something simple but I can't for the life
of
> me find it!
>
> If any of you can help me I would really appreciate it!
>
> Thank you very much!
> Andy
>





Fri Oct 26, 2007 2:21 pm

millerdw2003
Offline Offline
Send Email Send Email

Forward
Message #2055 of 2062 |
Expand Messages Author Sort by Date

Hi, I'm pretty new to Perl and need some help! I am working on a project that requires 4 forms on the same page. I would like to be able to submit each one...
Andy Schafer
lostgameparts
Offline Send Email
Oct 25, 2007
6:10 pm

... Hi, The solution is HTML related. All that you have to do is to add "target" attribute to the <form> element: <form ... target="_blank" >. In this case the...
Marcel Preda
marcel_preda
Offline Send Email
Oct 26, 2007
6:17 pm

Andy, I think the best way to accomplish what you're trying to do is to use AJAX. AJAX allows you to use JavaScript to issue an HTTP POST or GET without...
millerdw2003
Offline Send Email
Oct 26, 2007
6:17 pm

... #!/usr/bin/perl -w use strict; use CGI qw(:standard); our $q=new CGI; our ($firstNumber,$secondNumber); # This perl script calls itself and posts variables...
kenshail2003
Offline Send Email
Oct 29, 2007
3:30 pm

... You write a script that calls itself. Here is a simple calculator example, but remember that it has to be run on a server. It uses cgi to send the entered...
kenshail2003
Offline Send Email
Oct 29, 2007
3:30 pm

Hi, Thank you both very much for you responses. I will try putting "target='blank'" in my form tag first since that is the easiest but I will definitely check...
Andy Schafer
lostgameparts
Offline Send Email
Oct 29, 2007
3:30 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help