Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Multiple submit actions.

Reply
Thread Tools

Multiple submit actions.

 
 
sam
Guest
Posts: n/a
 
      12-28-2004
Hi,

I tried to create a form which embedded with another form, thus I expect
the second submit button will call the second cgi script, the main
submit button will call the main cgi script seperately.

eg.
print "<Form action=main.cgi>\n";
print "<table>\n";
print "<td><form action=second.cgi>\";
print "<input type=submit value=\"Outlets\">\n";
print "</form></td>\n";
print "</table>\n";
print "<td><form action=queryl.pl><input type=submit
value=\"MainQuery\"></form>\n";

in the above coding, pressed the MainQuery submit button actually called
to main.cgi script instead of query1.pl.

How can I change this?

Thanks
Sam
 
Reply With Quote
 
 
 
 
Jürgen Exner
Guest
Posts: n/a
 
      12-28-2004
sam wrote:
[...]
> eg.
> print "<Form action=main.cgi>\n";
> print "<table>\n";
> print "<td><form action=second.cgi>\";
> print "<input type=submit value=\"Outlets\">\n";
> print "</form></td>\n";
> print "</table>\n";
> print "<td><form action=queryl.pl><input type=submit
> value=\"MainQuery\"></form>\n";
>
> in the above coding, pressed the MainQuery submit button actually
> called to main.cgi script instead of query1.pl.
>
> How can I change this?


Your use of the print() function seems to be correct, although some people
would probably recommend to use CGI.pm instead.

If you have questions about HTML or CGI then you may want to ask in a
newsgroup that actually deals with such languague/interface.

jue


 
Reply With Quote
 
 
 
 
sam
Guest
Posts: n/a
 
      12-28-2004
Jürgen Exner wrote:

> sam wrote:
> [...]
>
>>eg.
>>print "<Form action=main.cgi>\n";
>>print "<table>\n";
>>print "<td><form action=second.cgi>\";
>>print "<input type=submit value=\"Outlets\">\n";
>>print "</form></td>\n";
>>print "</table>\n";
>>print "<td><form action=queryl.pl><input type=submit
>>value=\"MainQuery\"></form>\n";
>>
>>in the above coding, pressed the MainQuery submit button actually
>>called to main.cgi script instead of query1.pl.
>>
>>How can I change this?

>
>
> Your use of the print() function seems to be correct, although some people
> would probably recommend to use CGI.pm instead.
>
> If you have questions about HTML or CGI then you may want to ask in a
> newsgroup that actually deals with such languague/interface.
>

I m sorry I posted this html question in the perl newsgroup.
But I couldn't found a related newsgroup for this. I may be better look
for those forum and mailing list instead.

Thanks
Sam

> jue
>
>

 
Reply With Quote
 
Chris Mattern
Guest
Posts: n/a
 
      12-28-2004
sam wrote:

> I m sorry I posted this html question in the perl newsgroup.
> But I couldn't found a related newsgroup for this. I may be better look
> for those forum and mailing list instead.
>

I believe the newsgroup you would be looking for is
comp.infosystems.www.authoring.cgi.

--
Christopher Mattern

"Which one you figure tracked us?"
"The ugly one, sir."
"...Could you be more specific?"
 
Reply With Quote
 
Lars Eighner
Guest
Posts: n/a
 
      12-28-2004
In our last episode, <cqr57k$1ld7$(E-Mail Removed)>, the lovely
and talented sam broadcast on comp.lang.perl.misc:

> Hi,


> I tried to create a form which embedded with another form, thus I expect
> the second submit button will call the second cgi script, the main
> submit button will call the main cgi script seperately.


This is a basic html question. You have improperly nested
<form> and <table>. This: <form><table></form></table> is
invalid. Furthermore you have <td> in the below AFTER YOU HAVE
CLOSED YOUR TABLE. If you attempted to validate your html, you
would have learned that. Find a basic html tutorial. This has
nothing to do with perl. It has nothing to do with CGI. You
cannot expect to do anything useful with any kind of CGI until
you can write valid html.

You can have two different forms on a page, each of which point
to a different cgi. But you cannot activate both of them at
once. In my humble opinion, it would be much better to have
one cgi as the master and let it invoke the appropriate
subroutine according to the value of the submit button. You can
have as many submit buttons as you please in a form. This is,
however, pointless until you learn html.

Here's a hint: create an html document first and validate it
before you try to get a CGI to produce that document.

> eg.
> print "<Form action=main.cgi>\n";
> print "<table>\n";
> print "<td><form action=second.cgi>\";
> print "<input type=submit value=\"Outlets\">\n";
> print "</form></td>\n";
> print "</table>\n";
> print "<td><form action=queryl.pl><input type=submit
> value=\"MainQuery\"></form>\n";


> in the above coding, pressed the MainQuery submit button actually called
> to main.cgi script instead of query1.pl.


It is a wonder it did anything at all, being as it is totally
invalid html. Your browser did that in the face of invalid
html. Another browser might have done it differently. There is
no one correct way for browsers to handle invalid html. (It is
true enough that not all browsers do the right thing with every
kind of valid html document, but if you don't give a browser
valid html, it doesn't have a chance.)

> How can I change this?


Writing valid html would be a start.

--
Lars Eighner http://www.velocityreviews.com/forums/(E-Mail Removed) http://www.io.com/~eighner/
I hate laundry month.
 
Reply With Quote
 
Sherm Pendley
Guest
Posts: n/a
 
      12-28-2004
sam wrote:

> I tried to create a form which embedded with another form


That's not valid HTML, so what browsers will do with it is undefined.

> thus I expect the second submit button will call the second cgi script


You expect too much. What happens in response to valid HTML is well
defined; what happens in response to invalid HTML is not.

> print "<Form action=main.cgi>\n";
> print "<table>\n";
> print "<td><form action=second.cgi>\";
> print "<input type=submit value=\"Outlets\">\n";
> print "</form></td>\n";
> print "</table>\n";
> print "<td><form action=queryl.pl><input type=submit
> value=\"MainQuery\"></form>\n";


Nothing wrong here, your Perl print() statements are fine. What was your
Perl question?

> How can I change this?


Fix your HTML. Ask about that in a more appropriate group - you'll find
them under the "comp.infosystems.www.authoring.*" hierarchy.

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
 
Reply With Quote
 
sam
Guest
Posts: n/a
 
      12-28-2004
Sorry for asking an out of topic question.
I have abandoned the use of CGI in solving this problem.

Thanks
Sam.

sam wrote:
> Hi,
>
> I tried to create a form which embedded with another form, thus I expect
> the second submit button will call the second cgi script, the main
> submit button will call the main cgi script seperately.
>
> eg.
> print "<Form action=main.cgi>\n";
> print "<table>\n";
> print "<td><form action=second.cgi>\";
> print "<input type=submit value=\"Outlets\">\n";
> print "</form></td>\n";
> print "</table>\n";
> print "<td><form action=queryl.pl><input type=submit
> value=\"MainQuery\"></form>\n";
>
> in the above coding, pressed the MainQuery submit button actually called
> to main.cgi script instead of query1.pl.
>
> How can I change this?
>
> Thanks
> Sam

 
Reply With Quote
 
Tad McClellan
Guest
Posts: n/a
 
      12-28-2004
sam <(E-Mail Removed)> wrote:

> I have abandoned the use of CGI in solving this problem.



Why?

Seems to me to be a perfectly good way of solving this problem.

What alternative "solution" have you discovered?


--
Tad McClellan SGML consulting
(E-Mail Removed) Perl programming
Fort Worth, Texas
 
Reply With Quote
 
sam
Guest
Posts: n/a
 
      12-28-2004
Tad McClellan wrote:

> sam <(E-Mail Removed)> wrote:
>
>
>>I have abandoned the use of CGI in solving this problem.

>
>
>
> Why?
>
> Seems to me to be a perfectly good way of solving this problem.
>
> What alternative "solution" have you discovered?
>
>

I know it is, but my client does not require this solution. I would
rather focus my effort in other area.

Thanks
Sam
 
Reply With Quote
 
Lars Eighner
Guest
Posts: n/a
 
      12-28-2004
In our last episode, <cqruuc$21t7$(E-Mail Removed)>, the lovely
and talented sam broadcast on comp.lang.perl.misc:

> Sorry for asking an out of topic question.
> I have abandoned the use of CGI in solving this problem.


But your problem wasn't CGI. It was that you do not write valid
html. You will have problems with anything you put on the web
until and unless you know how to compose valid html.

--
Lars Eighner (E-Mail Removed) http://www.io.com/~eighner/
Health is merely the slowest possible rate at which one can die.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Forms with multiple submit buttons vs 'form' objects with single 'submit' methods neil.fitzgerald@ic.ac.uk Python 4 04-14-2006 04:58 PM
Catching Submit Event even called by document.forms[0].submit() The Crow ASP .Net 2 09-27-2005 05:03 PM
Preventing Multiple submit (Disabling Submit Button Post Click) Solution Mark ASP .Net 1 12-13-2004 08:03 PM
Disable Submit Button on Post back and On Submit in ASP.net Ghafran Abbas ASP .Net 0 10-12-2004 06:11 PM
Multiple forms and Multiple submit buttons and validation sandyde2 Javascript 2 10-02-2003 09:25 AM



Advertisments