在knockout js中验证电子邮件时调用自定义函数
我正在使用knockout js验证电子邮件并通过错误,而如果电子邮件同时无效,我想调用函数调用我试图做类似的事情但不起作用请有人帮助我知道执行此操作的确切方法
email: ko.observable((ref = REGISTRY.unsavedUser) != null ? ref.email : void 0).extend({
required: true,
email: {
params: true,
message: 'Please enter a valid emails.',
},
validation: {
validator: testFuc
},
focus:true
}),
,testFuc是作为
var testFun = function() {
alert();
}
i am validating email with knockout js and throughing error while if email not valid on the same time i want to invoke a fuction call iam trying to do somthing like that but not working please someone help i know the exact way to do that
email: ko.observable((ref = REGISTRY.unsavedUser) != null ? ref.email : void 0).extend({
required: true,
email: {
params: true,
message: 'Please enter a valid emails.',
},
validation: {
validator: testFuc
},
focus:true
}),
and testFuc is as
var testFun = function() {
alert();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
与函数名称
testFun
不匹配还要确保您的函数是在敲除脚本之前定义的
does not match the function name
testFun
also make sure your function is defined before your knockout script