★ wanayoo — archive 1999 http://developer.iplanet.com/docs/examples/javascript/multiple_cgi.htmlNouvelle recherche | Portail wanayoo
iPlanet

You are here:  Home > Developers > Sample Code > JavaScript > JavaScript Sample Code
JavaScript Sample Code
 iPlanet Developers


Developer Program
  Membership
  One-to-One Support
  Newsgroups
  Member Services

Developer Publications
  View Source
  Developer News

Documentation
  Technical Manuals
  White Papers
  TechNotes
  Sample Code
  FAQs
  Books

Technologies
  CSS
  DOM
  CORBA
  Directory & LDAP
  Dynamic HTML
  Java
  JavaScript
  Linux
  RDF
  Security
  SSJS
  XML
  XUL

Developer Downloads
  Tools & SDKs
  Patches

iPlanet Products
  Technical Resources










spacer
Submitting A Single Form To Multiple CGIs

Occassionally it may be necessary to submit a form to multiple CGIs based on a particular condition. With JavaScript, it is possible to dynamically change the 'action' property of the form. The example below demonstrates this.

NOTE: Please change the destination URL accordingly.

<html>
<head>
<h3>Submitting a single form to multiple CGIs</h3>
<script>
function submitToCGI1()
{
        document.myForm.action =
"/old?u=http%3A%2F%2Fgraphite%2Fcgi-bin%2Fjunhe%2Fechotext%2F&y=1999"
        document.myForm.submit();
}

function submitToCGI2()
{
        document.myForm.action =
"/old?u=http%3A%2F%2Fgraphite%2Fcgi-bin%2Fjunhe%2Fechotext1%2F&y=1999"
        document.myForm.submit();
}
</script>
</head>

<body>
<form name="myForm" METHOD=POST>
<input type=text name=text1>
<input type=text name=text2> 
<input type=button value="Submit 1" onClick="submitToCGI1()">
<input type=button value="Submit 2" onClick="submitToCGI2()">
</form>
</body>
</html>


Related Reading


Any sample code included above is provided for your use on an "AS IS" basis, under the Netscape License Agreement - Terms of Use

spacer spacer


                                                       
iPlanet International | Year 2000 | Site Map | Feedback
Products | Solutions | Support | Services | Download | About Us | Developer
© 2000 Sun-Netscape Alliance. All Rights Reserved  Privacy Policy