简体   繁体   English

我如何找到引发脏表单弹出的原因?

[英]How can I find what triggered a dirtyforms popup?

I have a form that normally works with respect to dirtyforms. 我有一个通常可以处理脏表单的表单。 However, there is one circumstance where a jquery-ui datapicker calendar will pop up the "are your sure" dialog when a date is clicked. 但是,在某些情况下,单击日期时,jquery-ui数据选择器日历将弹出“您确定”对话框。

I emphasize that this normally works correctly. 我强调这通常可以正常工作。 The situation is related to the initial conditions of the form data source. 这种情况与表单数据源的初始条件有关。 Things work when the object being referenced is existing, but not if it is new. 当被引用的对象存在时,事情就起作用了,但如果是新对象,则事情就没有了。 So I am sure somewhere there is a difference in the initial conditions of the form. 因此,我敢肯定,表格的初始条件会有所不同。 But in theory the form should be identical. 但从理论上讲,形式应相同。

How can I find what is causing the popup so I can fix my issue? 如何找到导致弹出窗口的原因,以便解决问题?

Well, I did find what was causing my problem by comparing the HTML of the working and non-working situations. 好吧,我确实通过比较正常和非正常情况的HTML找出了导致我的问题的原因。 (Not an easy task since there were many non-relevant differences.) (因为存在许多不相关的差异,所以这不是一件容易的事。)

Seems that the original coder did a strange thing. 似乎原来的编码器做了一件奇怪的事。 Left out some Javascript function declarations when the page was "new" but of course did not eliminate the calls on those functions. 当页面为“ new”时,省略了一些Javascript函数声明,但当然并没有消除对这些函数的调用。

So I guess that the javascript errors were the root cause. 因此,我认为javascript错误是根本原因。 At least when I include those function declarations everything works correctly. 至少当我包含这些函数声明时,一切都可以正常工作。

By default, most anchor links on the page will trigger the dialog . 默认情况下, 页面上的大多数锚链接都将触发对话框 We don't have a hard-coded selector of all potential 3rd party widgets, you must manually take inventory of whether these widgets use hyperlinks and ignore them if they are causing errant behavior. 我们没有所有潜在的第三方小部件的硬编码选择器,您必须手动清点这些小部件是否使用超链接,如果它们导致错误的行为,则将其忽略。

See ignoring things for more information. 有关更多信息,请参见忽略事物

I was unable to reproduce this behavior using Dirty Forms 2.0.0, jQuery UI 1.11.3, and jQuery 1.11.3. 我无法使用Dirty Forms 2.0.0,jQuery UI 1.11.3和jQuery 1.11.3重现此行为。 However, in previous versions of Dirty Forms, you can probably use the following code to ignore the hyperlink clicks from the DatePicker. 但是,在早期版本的“脏表单”中,您可能可以使用以下代码忽略DatePicker中的超链接单击。

$('.ui-datepicker a').addClass($.DirtyForms.ignoreClass);

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

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