jQuery验证不显示自定义消息

时间:2017-08-16 22:46:08

标签: javascript jquery jquery-validate unobtrusive-validation

我正在使用jQuery Validation Plugin。我的验证显然有效。但是,我的自定义错误消息无法正确显示?

  • 我正在使用不引人注目的以及验证

http://jsfiddle.net/NPqSr/212/

感谢您的帮助...

JAVASCRIPT:

dictionary.elements.form.validate({
    rules: {
        txtBSAPLocalAddress: {
            required: true
        },
        txtBSAPGlobalAddress: {
            required: true
        },
        txtBSAPDeviceLevel: {
            required: true
        }
    },
    messages: {
        txtBSAPLocalAddress: "Local Address is required.",
        txtBSAPGlobalAddress: "Global Address is required.",
        txtBSAPDeviceLevel: "Device is required."
    }

HTML:

<form>
    <table class="table">
        <tbody>
            <tr class="LocalAddress">
                <td>
                    <label for="txtBSAPLocalAddress">Local Address</label>
                </td>
                <td>
                    <input type="text" class="form-control input-sm" id="txtBSAPLocalAddress" name="txtBSAPLocalAddress" placeholder="0 to 254..." required />
                    <span class="field-validation-valid text-danger" data-valmsg-for="txtBSAPLocalAddress" data-valmsg-replace="true"></span>
                </td>
            </tr>
            <tr class="GlobalAddress">
                <td>
                    <label for="txtBSAPGlobalAddress">Global Address</label>
                </td>
                <td>
                    <input type="text" class="form-control input-sm" id="txtBSAPGlobalAddress" name="txtBSAPGlobalAddress" placeholder="0 to 254..." required />
                    <span class="field-validation-valid text-danger" data-valmsg-for="txtBSAPGlobalAddress" data-valmsg-replace="true"></span>
                </td>
            </tr>
            <tr class="DeviceLevel">
                <td>
                    <label for="txtBSAPDeviceLevel">Device Level</label>
                </td>
                <td>
                    <input type="text" class="form-control input-sm" id="txtBSAPDeviceLevel" name="txtBSAPDeviceLevel" placeholder="0 to 6..." required />
                    <span class="field-validation-valid text-danger" data-valmsg-for="txtBSAPDeviceLevel" data-valmsg-replace="true"></span>
                </td>
            </tr>
        </tbody>
    </table>
</form>

0 个答案:

没有答案