$(function () {
    function ValidTemp() {
        var DDRName = $("#DDRName"),
        zhupin = $("#zhupin"),
        rongliang = $("#rongliang"),
        Memo = $("#Memo")
        allFields = $([])
                .add(DDRName)
                .add(zhupin)
                .add(rongliang)
                .add(Memo)
        ;
        var bValid = true;
        allFields.removeClass("ui-state-error");
        bValid = bValid && checkLength(DDRName, "内存名称", 1, 50);
        bValid = bValid && checkLength(zhupin, "内存主频", 1, 50);
        bValid = bValid && checkLength(rongliang, "内存容量", 1, 50);
        return bValid;
    };
    $("form").submit(function () {
        if (!ValidTemp()) {
            $(this).find("button[type=submit]").removeClass("loading").removeAttr("disabled");
            return false;
        }
    });
});