如何使用HTMl5验证jsp页面

时间:2014-06-14 06:24:48

标签: java html5 jsp html5-canvas html5-video

我在一个表单中有两个提交按钮,如果我点击第一个提交按钮(即cashPaymentDiv save butoon)两个提交按钮字段都在验证。我想在提交表单时只验证一个div。

    <form name="customerForm" action="saveTransactionBill.do">

<div id="paymentModeDiv">
                        <table>
                            <tr>
                                <td><label
                                    style="margin: 0; width: 100px; display: block; padding: 5px 0; color: #737373; font: bold 12px Arial, Helvetica, sans-serif; float: left;">Payment
                                        Mode:</label></td>
                                <td><select onchange="showPaymentDivs();"
                                    name="paymentMode">
                                        <option value="">--Select--</option>
                                        <option value="cash">Cash</option>
                                        <option value="cheque">Cheque</option>
                                </select></td>
                            </tr>
                        </table>
                    </div>
<div id="cashPaymentDiv" class="required">
<table>
<tr>
<td><label>Amount Paid:</label></td>
<td><input name="amountPaid" id="cashPaymentForBillWise" onchange="calculateBalAmount();"
required x-moz-errormessage="Enter Username" pattern="[0-9]{0,20}"
title="Please enter only numrics." ></td>
</tr>

<tr>
<td><input type="submit" value="cash Save"></td>
</tr>
</table>
</div>

<div id="chequePaymentDiv" class="required">
<table>
<tr>
<td><label>Amount Paid:</label></td>
<td><input name="amountPaid" id="cashPaymentForBillWise" onchange="calculateBalAmount();"
required x-moz-errormessage="Enter Username" pattern="[0-9]{0,20}"
title="Please enter only numrics." ></td>
</tr>

<tr>
<td><input type="submit" value="cheque Save"></td>
</tr>
</table>
</div>
</form>

0 个答案:

没有答案