rannat rannat - 1 month ago 19
Javascript Question

Validation of form with several tabs

I have a form divided into several tabs and seems like the validation is not working on such form.

Configured as follows:

elements:[
{
view:"tabview",
tabbar:{ options:["Setings","Summary"]}, animate:false,
cells:[
{ id:"Setings", rows:[
{ view:"datepicker", name:"post"}
]},
{ id:"Summary", rows:[
{ view:"text", name:"title", label:"New title" }
]}
]
}
],
rules:{
"post":webix.rules.isNotEmpty,
"title":webix.rules.isNotEmpty,
}


As an illustration:
value
param in the
onAfterValidation
event includes only inputs from the current tab (should be filled with the invalid ones)

on:{
onAfterValidation:function(result, value){
if (!result) console.log(value);
else console.log(value);
}
},


Sample.

Any ideas how to implement validation for several tabs? Thanks.

Answer

Solved. There's a possibility to invoke the validation for the hidden inputs:

$$("postform").validate({hidden:true});

Updated snippet

Comments