$(function () {
    function ValidTemp() {
        var SATAName = $("#SATAName"),
        rongliang = $("#rongliang"),
        jiekou = $("#jiekou"),
        zhuansu = $("#zhuansu"),
        Memo = $("#Memo")
        allFields = $([])
        .add(SATAName)
        .add(rongliang)
        .add(jiekou)
        .add(zhuansu)
        .add(Memo)
        ;
        var bValid = true;
        allFields.removeClass("ui-state-error");
        bValid = bValid && checkLength(SATAName, "硬盘名称", 1, 50);
        bValid = bValid && checkLength(rongliang, "硬盘容量", 1, 50);
        bValid = bValid && checkLength(jiekou, "接口标准", 1, 50);
        bValid = bValid && checkLength(zhuansu, "硬盘转速", 1, 50);
        return bValid;
    };
    $("form").submit(function () {
        if (!ValidTemp()) {
            $(this).find("button[type=submit]").removeClass("loading").removeAttr("disabled");
            return false;
        }
    });
});