html validation before submitting form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • pcmarket
    New Member
    • Jan 2013
    • 3

    html validation before submitting form

    How can I check validation before submitting the form.

    Code:
        </script>
    </head>
    <body dir="rtl">
    <form name="form1" action="pay.php" method="post">
    <table align="center" cellpadding="0" cellspacing="0" width="100%">
    <tbody>
    <tr>
    <td>
    <table class="InputTable" align="center" cellpadding="0" cellspacing="0">
    <tbody>
    <tr>
    <td>
    <table class="MainTable" align="center" cellpadding="1" cellspacing="5" height="153" width="421">
    <tbody>
    <tr class="HeaderTr">
    <td colspan="2" align="center" height="30px"><span class="HeaderText">اطلاعات پرداخت</span></td></tr>
    <tr class="RowF">
    <td class="LabelTd"><span>نام و نام خانوادگی :</span></td>
     
    <td><input name="Name" class="textbox" type="text" /><font color="#ff0000" size="1">*</font></td></tr>
    <tr class="RowZ">
    <td class="LabelTd"><span>مبلغ پرداختی :</span></td>
    <td>                                    <input name="Amount" class="textbox" onkeyup="data_change(this)" type="text" /> <font size="1"><font color="#ff0000">*</font> </font><font size="1">ریال</font></td></tr>
    <tr class="RowF">
    <td class="LabelTd"><span>روش ارسال  : </span></td>
    <td><select name="Title" class="combobox">
    <option>از طريق شركت پست </option>
    <option>ارسال با باربري</option>
    <option>ارسال رايگان</option>
    <option>پرداخت  هزينه پست درب منزل</option></select>                                    </td></tr>
    <tr class="RowZ">
    <td class="LabelTd">
                                            شماره موبايل<span> :</span></td>
    <td>                                    <input name="Email2" class="textbox" type="text" /><font size="1"><font color="#ff0000">*</font> </font><span class="comment">جهت ارسال رسيد سفارش</span></td></tr>
    <tr class="RowF">
    <td class="LabelTd">
                                            آدرس دقيق پستي <span>:</span></td>
    <td>
    <p>                                    <input name="Email" class="textbox" type="text" /><font size="1"><font color="#ff0000">*</font> </font><span class="comment">جهت ارسال بسته</span></p></td></tr>
    <tr class="RowZ">
    <td colspan="2" align="center" height="30px"><font size="1"><font color="#ff0000">*</font> <font color="#ff0000"></font> بايد پر شود </font><font size="2"><font color="#0000ff"> </font></font><font size="2"><font color="#0000ff"></font></font><font size="1"> <font color="#0000ff"><font size="2"></font>&nbsp;</font> </font><br />
    <input class="button" name="PayRequestButton" value="پرداخت" type="submit" /></td></tr></tbody></table>                            </td></tr></tbody></table></td></tr></tbody></table>
    <pre>    </pre></center></form>
     
     
     
    </body>
    </html>
    Last edited by acoder; Jan 14 '13, 10:25 PM. Reason: Moved to the JavaScript forum
  • pcmarket
    New Member
    • Jan 2013
    • 3

    #2
    Please use showing the location of the new validation codes and how to use the codes say thanks

    Comment

    • Anas Mosaad
      New Member
      • Jan 2013
      • 185

      #3
      Create a JS function that returns a boolean (i.e. named validate). Add onsubmit="retur n validate()" to the form.

      Comment

      • pcmarket
        New Member
        • Jan 2013
        • 3

        #4
        hello
        plz end me how use validation codes

        Comment

        Working...