Is this the best way to point to different CGI scripts?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • JR

    Is this the best way to point to different CGI scripts?

    Hi. I have a CGI script that will need to call itself an unknown
    number of times, to add rows, run queries, etc. At the bottom of the
    output that is produced by the script, there are four buttons. I need
    one of the buttons to simply be a back button. I have this button
    working fine. I need the second and fourth buttons to point to the
    current CGI script, but I need the third button to point to a
    different CGI script. I need the second, third and fourth buttons to
    pass their respective scripts all data entered on the form.

    My clients will be using the most recent versions of IE and Netscape.
    Is below a workable method of doing this? I will not be able to
    actually test this myself until tomorrow. I've looked at the FAQs,
    and there are many ways of using <input type...> to point to different
    CGI scripts with different buttons, but because I'm using hyperlink
    images to call submit, I don't know that the answers I found apply to
    this particular problem.

    If this isn't a workable method, could someone please provide me with
    some code that is workable? Unfortunatley, I'm not a JavaScript guru,
    and this is the best up with which I could come (I also tried using
    functions, changing the document directly with syntax found on the
    FAQs, but to no avail).

    Thanks much!

    <html>
    <head>
    <link rel="stylesheet " href="myCSS.css ">
    <SCRIPT LANGUAGE = "JavaScript " src="myJS.js">
    </SCRIPT>
    </head>
    <body bgcolor=#00CCFF >

    <!-- Lots of CGI script code -->

    <form name="form1" action="p1.cgi" >
    <input type="text" name="input">
    <br><br>
    <a href='javascrip t:history.back( );'
    onMouseover="b1 .src='i1_on.gif ';"
    onMouseout="b1. src='i1_off.gif ';">
    <img SRC="i1_off.gif "></a>

    <a href='javascrip t:document.form 1.submit();'
    onMouseover="b2 .src='i2_on.gif ';"
    onMouseout="b2. src='i2_off.gif ';">
    <img SRC="i2_off.gif "></a>

    <!-- Change the form location. Will this get the data
    on the form, as well as change the location? -->
    <a href='javascrip t: document.form1. action = "p2.cgi";
    javascript:docu ment.form1.subm it();'
    onMouseover="b3 .src='i3_on.gif ';"
    onMouseout="b3. src='i3_off.gif ';">
    <img SRC="i3_off.gif "></a>

    <!-- Change the form location back to its original location. -->
    <a href='javascrip t: document.form1. action = "p1.cgi";
    javascript:docu ment.form1.subm it();'
    onMouseover="b4 .src='i4_on.gif ';"
    onMouseout="b4. src='i4_off.gif ';">
    <img SRC="i4_off.gif "></a>

    </form>
    </body>
    </html>
  • Ron

    #2
    Re: Is this the best way to point to different CGI scripts?

    JR wrote:
    [color=blue]
    >Hi. I have a CGI script that will need to call itself an unknown
    >number of times, to add rows, run queries, etc. At the bottom of the
    >output that is produced by the script, there are four buttons. I need
    >one of the buttons to simply be a back button. I have this button
    >working fine. I need the second and fourth buttons to point to the
    >current CGI script, but I need the third button to point to a
    >different CGI script. I need the second, third and fourth buttons to
    >pass their respective scripts all data entered on the form.
    >
    >My clients will be using the most recent versions of IE and Netscape.
    >Is below a workable method of doing this? I will not be able to
    >actually test this myself until tomorrow. I've looked at the FAQs,
    >and there are many ways of using <input type...> to point to different
    >CGI scripts with different buttons, but because I'm using hyperlink
    >images to call submit, I don't know that the answers I found apply to
    >this particular problem.
    >
    >If this isn't a workable method, could someone please provide me with
    >some code that is workable? Unfortunatley, I'm not a JavaScript guru,
    >and this is the best up with which I could come (I also tried using
    >functions, changing the document directly with syntax found on the
    >FAQs, but to no avail).
    >
    >Thanks much!
    >
    ><html>
    > <head>
    > <link rel="stylesheet " href="myCSS.css ">
    > <SCRIPT LANGUAGE = "JavaScript " src="myJS.js">
    > </SCRIPT>
    > </head>
    > <body bgcolor=#00CCFF >
    >
    ><!-- Lots of CGI script code -->
    >
    > <form name="form1" action="p1.cgi" >
    > <input type="text" name="input">
    > <br><br>
    > <a href='javascrip t:history.back( );'
    > onMouseover="b1 .src='i1_on.gif ';"
    > onMouseout="b1. src='i1_off.gif ';">
    > <img SRC="i1_off.gif "></a>
    >
    > <a href='javascrip t:document.form 1.submit();'
    > onMouseover="b2 .src='i2_on.gif ';"
    > onMouseout="b2. src='i2_off.gif ';">
    > <img SRC="i2_off.gif "></a>
    >
    ><!-- Change the form location. Will this get the data
    > on the form, as well as change the location? -->
    > <a href='javascrip t: document.form1. action = "p2.cgi";
    > javascript:docu ment.form1.subm it();'
    > onMouseover="b3 .src='i3_on.gif ';"
    > onMouseout="b3. src='i3_off.gif ';">
    > <img SRC="i3_off.gif "></a>
    >
    ><!-- Change the form location back to its original location. -->
    > <a href='javascrip t: document.form1. action = "p1.cgi";
    > javascript:docu ment.form1.subm it();'
    > onMouseover="b4 .src='i4_on.gif ';"
    > onMouseout="b4. src='i4_off.gif ';">
    > <img SRC="i4_off.gif "></a>
    >
    ></form>
    ></body>
    ></html>
    >
    >[/color]
    Alter to the following, some typos fixed and a default script type
    registered in the header to aid the browser. The "language" attribute is
    deprecated in favor of mimetype:

    <?xml version="1.0"?>
    <?xml-stylesheet href="myCSS.css " type="text/css"?>
    <?xml-stylesheet href="#thisStyl e" type="text/css"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
    <meta http-equiv="Content-Type" content="applic ation/xhtml+xml" />
    <meta http-equiv="Content-Script-Type" content="text/javascript" />
    <!-- IE does not support XML stylesheet PIs, and XHTML processors ignore stylesheet links -->
    <link rel="stylesheet " href="myCSS.css " type="text/css" />
    <script type="text/javascript" src="myJS.js">
    </script>
    <style id="thisStyle" >
    <![CDATA[
    body {
    background-color:#00CCFF
    }
    ]]>
    </style>
    </head>
    <body>

    <!-- Lots of CGI script code -->

    <form name="form1" action="p1.cgi" >
    <input type="text" name="input" />
    <br /><br />
    <a href="javascrip t:history.back( );"
    onmouseover="b1 .src='i1_on.gif ';"
    onmouseout="b1. src='i1_off.gif ';">
    <img src="i1_off.gif " /></a>

    <a href="javascrip t:document.form 1.submit();"
    onmouseover="b2 .src='i2_on.gif ';"
    onmouseout="b2. src='i2_off.gif ';">
    <img src="i2_off.gif " /></a>

    <!-- Change the form location. Will this get the data
    on the form, as well as change the location? -->
    <a href="javascrip t:document.form 1.action = 'p2.cgi';docume nt.form1.submit ();"
    onmouseover="b3 .src='i3_on.gif ';"
    onmouseout="b3. src='i3_off.gif ';">
    <img src="i3_off.gif " /></a>

    <!-- Change the form location back to its original location. -->
    <a href="javascrip t:document.form 1.action = 'p1.cgi';docume nt.form1.submit ();"
    onmouseover="b4 .src='i4_on.gif ';"
    onmouseout="b4. src='i4_off.gif ';">
    <img src="i4_off.gif " /></a>

    </form>
    </body>
    </html>


    Since your clients are using the most recent browsers, I've also updated
    the markup to the latest standards. Otherwise, your code should work;
    I've had to switch forms like this myself. :)

    Comment

    • Jack Black

      #3
      Re: Is this the best way to point to different CGI scripts?

      Thanks for the response and the modifications. I'm very relieved to
      know that this method can actually work!

      Joe




      *** Sent via Developersdex http://www.developersdex.com ***
      Don't just participate in USENET...get rewarded for it!

      Comment

      Working...