Ask Experts Questions for FREE Help !
Ask
    Ranjan kumar's Avatar
    Ranjan kumar Posts: 1, Reputation: 1
    New Member
     
    #1

    Sep 3, 2015, 10:35 PM
    How do I send data to a javascript file to a java file
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <meta charset="ISO-8859-1">
    <title>new user</title>
    </head>
    <body>
    <script language="javascript" type="text/javascript">


    function validate()
    {
    // get inputs
    fname = document.getElementById("fname").value;
    lname = document.getElementById("lname").value;
    email = document.getElementById("email").value;
    phone = document.getElementById("phone").value;
    pswd = document.getElementById("paswd").value;
    cpswd = document.getElementById("conpswd").value;
    country = document.getElementById("Country").value;
    //create an empty error message
    errors = "";
    //check name - It simply needs to exist
    if (fname == "")
    {
    errors += "please supply a name \n";
    } // end if
    //check email
    emailRE = /^.+@.+\..{2,4}$/;
    if (email.match(emailRE)){
    //console.log("email match");
    //do nothing.
    } else {
    //console.log(“email not a match”);
    errors += "please check email address \n";
    } // end if
    //check phone number
    phoneRE = /^\d{10}$/;
    if (phone.match(phoneRE)){
    //console.log(“phone matches”);
    //do nothing
    }
    else
    {
    //console.log(“phone problem”);
    errors += "please check phone #\n";
    } // end phone if
    //check for errors
    if(pswd==""){
    errors +="provide password"
    }
    if (errors == "")
    {
    window.location.href="http://localhost:2015/login_page/registerservlet"//process the form
    }
    else
    {
    alert(errors);


    } // end if
    } // end function
    </script>
    Enter ur Detail:<br/><br/>
    <form action="registerservlet" method="post">
    First Name:<input type="text" id=" id="><br/>
    Last Name:<input type="text" id="><br/>
    Last Name:<input type="><br/>
    Email:<input type="text" id=" id="><br/>
    phone:<input type="text" id="><br/>
    Email:<input type="><br/>
    password:<input type="text" id=" id="><br/>
    Confirm Password:<input type="text" id="><br/>
    phone:<input type="><br/>
    Country:<select id=" id=">
    <option value="india"><br/>
    password:<input type="USA" id="America"><br/>
    Confirm Password:<input type="ua" id="pak"><br/>
    Country:<select id="button">
    <option value="submit"> India </option>
    <option value="validate()"/></form>

    </body>
    </html>
    CravenMorhead's Avatar
    CravenMorhead Posts: 4,532, Reputation: 1065
    Adult Sexuality Expert
     
    #2

    Sep 4, 2015, 07:19 AM
    Hi!

    Posting code, while enlightening to what you're trying to do, is almost useless because you haven't described exactly what you want to do. This also looks a lot like home work. I think you need to look at your notes and where you are in your textbook and the lessons for the answer. I've done a computer science degree, most of the time the answers are in the course material.

    If you post a more detailed explination as to what you want to do, then it should be easier to help.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

Batch file with java [ 0 Answers ]

When calling batch file from java in a loop it get an accurate results becoz it called multiple time. Any help please ? Thanks all

To create jar file in java [ 1 Answers ]

Hi, I want to create an executable file for my console application program. It is a network file sharing program, need to run on double click or command line. This program contains 11 class files in which FileSharing.class is the main class file. I have created manifest.txt file with...


View more questions Search