Results 1 to 2 of 2
  1. #1
    a2a.sharath is offline Member
    Join Date
    May 2012
    Posts
    1
    Rep Power
    0

    Default how to create product form

    <script language="javascript" type="text/javascript">
    function addPro()
    {
    var x = document.forms["addproduct"]["productid"].value;
    var x1 = document.forms["addproduct"]["productname"].value;
    var x2 = document.forms["addproduct"]["price"].value;
    var x3= document.forms["addproduct"]["quantity"].value;
    var numcheck=/^[0-9]+$/;
    var alphacheck=/^[a-zA-Z]+$/;
    var alphanumeric=/^[0-9]+[a-zA-Z]+$/;

    if(x=="" || x==null || x==0 ||alphanumeric.test(x))
    {
    alert("Enter the valid ProductID");
    return false;
    }
    else if(x1=="" || x1==null || alphanumeric.test(x1))
    {
    alert("Enter the valid Product Name");
    return false;
    }
    else if(x2=="" || x2==null || numcheck.test(x2)!=1 || x2==0 )
    {
    alert("Enter the valid Product Price");
    return false;
    }
    else if(x3=="" || x3==null || numcheck.test(x3)!=1 || x3==0)
    {
    alert("Enter the valid Product Quantity");
    return false;
    }
    else
    document.location.href="http://localhost:8080/UserAdministration/com.ilp.inventory.useradministration.controller/ProductController";
    }
    function reset()
    {
    exit(0);
    }

    </script>
    <title>Add Products</title>
    </head>
    <body >

    <form name="addproduct" action="http://localhost:8080/UserAdministration/com.ilp.inventory.useradministration.controller/ProductController">
    <h1>Add Products</h1>
    <table>
    <tr>

    <tr>
    <td>
    Product Name <font color="red">* </font>:</td><td> <input type="text" name="productname"/><br/><br/></td>
    </tr>

    <tr>
    <td>
    Product Description<font color="red">* </font>:</td><td> <textarea name ="productdescription" rows="3" cols="20"></textarea><br/><br/></td>
    </tr>

    <tr>
    <td>
    Product Price<font color="red"> *</font>:</td><td><input type="text" name="price"/><br/><br/></td>
    </tr>

    <tr>
    <td>
    Product Quantity<font color="red"> * </font>:</td><td> <input type="text" name="quantity"/><br/><br/></td>
    </tr>


    <tr>
    <td>

    <input type="submit" onclick=" return addPro()" value="Submit"/>
    <input type="button" onclick="reset()" value="Reset"/>
    </td>
    </tr>

    </table>
    <input type="hidden" name="product" value="addproduct"></input>
    </form>

    </body>
    </html>

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,863
    Rep Power
    19

    Default Re: how to create product form

    1. Please use [code] tags [/code] when posting code.
    2. You haven't actually asked a question.
    3. There's no Java there. Javascript != Java.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Create registration form | insert into database | call the database
    By FamilyGuy in forum JavaServer Pages (JSP) and JSTL
    Replies: 3
    Last Post: 04-23-2012, 11:08 AM
  2. Replies: 2
    Last Post: 08-15-2011, 08:05 AM
  3. Replies: 0
    Last Post: 06-14-2010, 05:21 AM
  4. Create a form, input some data and save to file
    By cselic in forum AWT / Swing
    Replies: 5
    Last Post: 05-07-2010, 12:28 PM
  5. Replies: 1
    Last Post: 03-22-2010, 09:03 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •