简体   繁体   English

jQuery验证引擎消息不可见

[英]Jquery validation engine message not visible

I'm using the following code to pump a message to JQuery validation engine: 我正在使用以下代码将消息泵送到JQuery验证引擎:

$(".ref2").validationEngine("showPrompt", "Please enter your references if you can", "error");

The issue is odd, when you submit the form with incorrect references, the error message is shown, closing the message and trying to resubmit appears to do nothing, the form doesn't submit and the error message doesn't show up. 问题很奇怪,当您使用错误的引用提交表单时,将显示错误消息,关闭该消息并尝试重新提交似乎无济于事,该表单未提交且该错误消息也未显示。

I've investigated and the error message IS being created, the div element exists but you just can't see it? 我已经调查过并且正在创建错误消息,div元素存在,但是您看不到它? Am I wrong in thinking you can just resend a prompt? 我以为您可以重新发送提示是错误的吗?

The error turned out to be that the Validation engine was being called twice in quick succession. 错误结果是快速连续两次调用了验证引擎。 What this did in this specific case was to set the Z index of the validation message to -50. 在此特定情况下,这是将验证消息的Z索引设置为-50。

I believe this to be quirk of the poorly formed javascript that was being used on the page at the time, as each successive call decremented the Z index by 25. So it was being hidden behind a label. 我相信这与当时在页面上使用的格式不正确的javascript有关,因为每个后续调用都会将Z索引递减25。因此它被隐藏在标签后面。

Removing the second call fixed the problem, and moving away to FluentValidation fixed my sanity. 删除第二个电话可以解决问题,然后移至FluentValidation可以解决我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM