$(function () {
    function ValidTemp() {
        var CPTName = $("#CPTName"),
        CardNum = $("#CardNum"),
        NetCard = $("#NetCard"),
        Memo = $("#Memo")
        allFields = $([])
        .add(CPTName)
        .add(CardNum)
        .add(NetCard)
        .add(Memo)
        ;
        var bValid = true;
        allFields.removeClass("ui-state-error");
        bValid = bValid && checkLength(CPTName, "主板名称", 1, 50);
        bValid = bValid && checkLength(NetCard, "载板网卡", 1, 50);
        bValid = bValid && checkNumlength(CardNum, "网卡数量", 1, 2147483647);
        return bValid;
    };
    $("form").submit(function () {
        if (!ValidTemp()) {
            $(this).find("button[type=submit]").removeClass("loading").removeAttr("disabled");
            return false;
        }
    });
});