0
我有一個Webix爲其提供了添加應該驗證的附加文本字段以及預定義字段的可能性。窗體:如何爲新添加的輸入添加驗證規則?
喜歡的東西未來:http://webix.com/snippet/73c90f29
function addFormInput(){
$$("form1").addView({
view:"text",
label:'Should be a number',
name:"text2",
value:"some",
labelPosition:"top"
}, 1);
};
webix.ui({
view:"form",
id:"form1",
elements: [
{
view:"text",
label:'Not empty',
name:"text1",
labelPosition:"top"
},
{cols:[
{
view:"button", type:"iconButton",
label:"Add new", icon:"plus",
click:function(){
addFormInput();
this.disable()
}
}
]}
],
rules:{
text1:webix.rules.isNotEmpty
}
});
但我堅持的添加驗證規則的一個新項目。怎麼做?它有可能嗎?提前致謝!
聽起來就像你需要一個事件來監聽添加新字段的時間,然後執行相應的代碼。 – colecmc
也許,但我希望我可以在'addView()'之後添加它。主要的問題是改變表單規則的(未知的)方法。 – rannat