To Generate form fields dynamically

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • divyac
    New Member
    • Aug 2008
    • 40

    #1

    To Generate form fields dynamically

    I am doing an inventory project using PHP in which there is a text box.The customer id should be entered in that text box.If that customer id is valid,another text box should be generated in which the product id should be entered..If that product id is valid,other 3 text boxes should be generated dynamically in order to do transaction.is it possible to generate forms without a button click?...The order of the forms should be as follows:

    [HTML]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Untitl ed Document</title>
    </head>
    <body>
    <form method="post" enctype="multip art/form-data">
    <table width="500" border="0" align="center" cellpadding="1" cellspacing="6" >
    <tbody>
    <tr class="text">
    <td align="left">Sc an/Enter Customer ID:</td>
    <td align="left"><i nput size="30" name="Name" id="Name" type="text" />
    </td>
    </tr>

    <tr class="text">
    <td align="left">Sc an/Enter Product ID:</td>
    <td align="left"><i nput size="30" name="productNa me" id="productName " type="text" /></td>
    </tr>

    <tr class="text">
    <td align="left">Pr oduct Type</td>
    <td align="left">
    <select name="productTy pe" id="productType ">
    <option value="Sales">S ales</option>
    <option value="Rental"> Rental</option>
    <option value="Both">Bo th</option>
    </select>
    </td>
    </tr>

    <tr class="text">
    <td align="left">Co st Price/Unit($):</td>
    <td align="left"><i nput size="30" name="costPrice " id="costPrice" type="text" />
    </td>
    </tr>

    <tr class="text">
    <td align="left">Qu antity:</td>
    <td align="left"><i nput size="30" name="Quantity" id="Quantity" type="text" />
    </td>
    </tr>

    <tr>
    <td colspan="2" align="center">
    <input type="submit" name="submit" value="Submit" id="submit" /> </td>
    </tr>
    </tbody>
    </table>
    </form>
    </body>
    </html>[/HTML]
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Originally posted by divyac
    If that customer id is valid,another text box should be generated in which the product id should be entered..If that product id is valid,other 3 text boxes should be generated dynamically in order to do transaction.is it possible to generate forms without a button click?
    Yes, just create them in your validation function.

    Comment

    Working...