$(function () {
    function ValidTemp() {
        var HomeName = $("#HomeName"),
        NetType = $("#NetType"),
        Memo = $("#Memo")
        allFields = $([])
        .add(HomeName)
        .add(NetType)
        .add(Memo)
        ;
        var bValid = true;
        allFields.removeClass("ui-state-error");
        bValid = bValid && checkLength(HomeName, "机房名称", 1, 50);
        bValid = bValid && checkLength(NetType, "网络类型", 1, 50);
        return bValid;
    };
    $("form").submit(function () {
        if (!ValidTemp()) {
            $(this).find("button[type=submit]").removeClass("loading").removeAttr("disabled");
            return false;
        }
    });
});