我在視圖中執行驗證時遇到了一些問題。在移動應用程序中驗證
我正在嘗試關注網站中的其中一個Devextreme示例。 http://js.devexpress.com/Demos/WidgetsGallery/#demo/editors-validation-overview
錯誤什麼,我得到的是「遺漏的類型錯誤:無法讀取屬性未定義‘驗證’」。同時點擊完成按鈕。
這是我在用代碼:` 用戶名: 密碼: 重新輸入密碼:
PaMobile01.popup = function (params, viewInfo) {
"use strict";
var openTabsAsRoot = viewInfo.layoutController.name === "split",
isReady = $.Deferred();
function handleViewShown() {
loadopetions();
}
function validateAndSubmit(params) {
var result = params.validationGroup.validate();
if (result.isValid) {
DevExpress.ui.notify({
message: "You have submitted the form",
position: {
my: "center top",
at: "center top"
}
}, "success", 3000);
}
}
function loadopetions() {
$("#tbx_userneme").dxTextBox({
placeholder: 'Required',
}).dxValidator({
validationRules: [{
type: "required",
message: "City is required"
}, {
type: "pattern",
pattern: "^[a-zA-Z]+$",
message: "Do not use digits in the City name."
}, {
type: "pattern",
pattern: "^.{2,}$",
message: "City must have at least 2 symbols"
}]
});
$("#tbx_password").dxTextBox({
placeholder: 'Required',
}).dxValidator({
validationRules: [{
type: "required",
message: "City is required"
}, {
type: "pattern",
pattern: "^[a-zA-Z]+$",
message: "Do not use digits in the City name."
}, {
type: "pattern",
pattern: "^.{2,}$",
message: "City must have at least 2 symbols"
}]
});
$("#tbx_repassword").dxTextBox({
placeholder: 'Required',
}).dxValidator({
validationRules: [{
type: "required",
message: "City is required"
}, {
type: "pattern",
pattern: "^[a-zA-Z]+$",
message: "Do not use digits in the City name."
}, {
type: "pattern",
pattern: "^.{2,}$",
message: "City must have at least 2 symbols"
}]
});
}
function handlefinish() {
validateAndSubmit(params);
}
return {
isReady: isReady.promise(),
viewShown: handleViewShown,
openTabsAsRoot: openTabsAsRoot,
handlefinish: handlefinish
}
};
嗨我也試過,也是b它也是拋出錯誤「Uncaught TypeError:無法讀取屬性'validate'的validateAndSubmit函數 – vishal
嗨,我現在能夠解決它現在thanx很多你的幫助。 – vishal
目前我正在面對其他兩個dxtextbox值的比較問題。 像上面的代碼中的密碼和reenterpassword一樣。 你能幫我解決這個問題嗎? – vishal