Hi, I’m new to Webix, first I congratulations for your great framework.
I have a question:
I’m developing a one-page application, and modified a Webix sample form for login which will send the username and password information to a web service via ajax. When I try I find that onValidationSuccess event fires more than once. Can you help me to find that what am I doing wrong? Thanks.
var frmLogin = [
{ view:"text", name:"nmUser", label:"Username", id:"idUser" },
{ view:"text", label:'Password', type:"password", name:"nmPass", id:"idPass" },
{ view:"button", value: "Submit", click:function()
{
this.getParentView().validate();
}
}
];
var winLogin = webix.ui({
view:"window",
id:"winLogin",
height:300,
position:"center",
width:400,
modal:true,
move:true,
head:{
view:"toolbar", cols:[
{view:"label", align: 'left', label: "Login Form", id:"winLogon"},
]
}
,
body:
{
view:"form", scroll:false, width:300,
elements: frmLogin,
rules:{
"nmPass":webix.rules.isNotEmpty,
"nmUser":webix.rules.isNotEmpty
},
elementsConfig:{
labelPosition:"top"
},
on:{
onValidationError:function(id, value)
{
var text;
if (id == "nmPass")
text = "Password is empty";
if (id == "nmUser")
text = "Username is empty";
webix.message({ type:"error", text:text });
},
onValidationSuccess:function()
{
webix.message("onValidationSuccess");
},
onAfterValidation:function()
{
webix.message("onAfterValidation");
}
}
}
});