EarthWeb
Developer.com
Site
windows 2000
visual c++
java
visual basic
javascripts
recommend it
 
Book
thinking in java
 
Interact
forum
guest book
jobs
jokes
what's new

share code
 
Resource
add resource
modify resource
new resource
 

[Internet Jobs]
-----
Java by E-mail:

Get the weekly e-mail highlights on Java!
-----

-

Retrieve values from a Java applet for HTML form (CGI)


Author: Real Gagnon
Author's WebSite: http://tactika.com/realhome/realhome.html

Retrieve the value with a Javascript function called via the onSubmit event of the form.

[myApplet.java]


 public class myApplet extends java.applet.Applet {
    public String getFirstName() {
        // return myTextField.getText();
        return "myApplet";
       }
 }




[HTML and Javascript]


<HTML><HEAD>
<SCRIPT>
function getValue(){
document.myForm.FirstName.value = document.myApplet.getFirstName();
return true;
}
</SCRIPT>
<BODY>
<APPLET CODE="myApplet.class"
NAME="myApplet"
HEIGHT=0 WIDTH=0>
</APPLET>
<FORM METHOD=POST
ACTION=" *** your CGI ***"
NAME="myForm"
onSubmit="return getValue()">
<INPUT TYPE="hidden"
VALUE="xxx"
NAME="FirstName">
<INPUT TYPE="submit"
VALUE="Submit" >
</FORM>
</BODY></HTML>


Posted On: 7-Jul-1999

internet.commerce



Acceptable Use Policy


The Network for Technology Professionals

Search:

About Internet.com

Legal Notices, Licensing, Permissions, Privacy Policy.
Advertise | Newsletters | E-mail Offers