Jquery JStree插件表单文本字段冲突
我在一组 Drupal 页面中有一组自定义 PHP 表单(不是通过 Drupal 表单 API 生成的 - 我不会解释为什么我不只是在这里使用 Drupal 来处理这些表单 - 有点复杂),并且文本输入字段不会”不允许键盘输入 - 但允许复制和粘贴。它们会正确填充默认值,但只是不允许您键入。一个例外是启用了 TinyMCE 的文本字段 - 此处可以正常输入文本,除非未加载 TinyMCE 脚本,在这种情况下,文本字段也不允许输入内容。
调整 Jquery Update 以允许加载最新的 1.4.2 库后出现问题,除非在 URL 中包含“admin”或“edit”的页面上,在这种情况下,将加载当前的 Jquery Update 2.x 库,以让所有管理区域行为正常运行。
通过排除过程,我发现我在自定义表单中用于某些嵌套复选框列表的 JStree 插件导致了问题。禁用后,文本输入就可以了。奇怪的是,问题发生在启用 JStree 的容器外部(通过使用特定选择器)的字段中,甚至会影响不同页面上没有 JStree 控制元素的其他自定义 PHP 表单中的字段。我尝试向文本输入和表单容器添加类,以尽可能模仿 Drupal 生成的表单中使用的类,但无济于事。 Drupal 形式并未受到这种奇怪冲突的影响。我已经在 Drupal 之外的 MAMP 中以精简形式测试了该问题,并且文本输入字段不受与 JStree 复选框列表相同形式存在的影响。
如果这听起来对任何人来说都很熟悉,或者如果有人可以提供一种进一步解决该问题的方法,我将非常感激。
I have a set of custom PHP forms within a set of Drupal pages (not generated through Drupal forms API - I won't explain why I'm not just using Drupal for these forms here - a tad complicated) with text entry fields won't allow keyboard input - but will allow copy and paste. They populate correctly with default values, but just won't let you type. An exception is a text field which has TinyMCE enabled - Text entry is fine here, unless the TinyMCE script isn't loaded, in which case the text field disallows type as well.
The problem arose after adjusting Jquery Update to allow the latest 1.4.2 library to be loaded unless on a page with 'admin' or 'edit' in the URL, in which case the current Jquery Update 2.x library would be loaded, to leave all admin area behaviours functioning.
Through a process of elimination, I've found that the JStree plugin I am using for some nested checkbox lists in my custom forms is causing the problem. When disabled, text entry is fine. Strangely, the problem occurs in fields outside of the container where JStree is enabled (by use of a specific selector), and even effects fields in other custom PHP forms on different pages, where there are no JStree controlled elements. I've tried adding classes to both the text inputs and form containers to mimic those used in Drupal generated forms as closely as possible, to no avail. Drupal forms remain untouched by this weird conflict. I've tested the issue in a stripped down form in MAMP, outside of Drupal, and text input fields are uneffected by existing in the same form as a JStree checkbox list.
If this sounds familiar to anyone, or if someone can offer a method to further trouble-shoot the issue, I would be hugely appreciative.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我通过重新排序主题 .info 文件中的脚本调用暂时解决了该问题。我现在将 JStree 附带的 Jquery 库的副本加载到所有其他脚本之上。我相信 Jquery Update 可能有一个补丁可以解决我将研究的正确脚本排序问题。
问题已关闭。
I've temporarily soved the issue by re-ordering the script calls in my theme .info file. I now load the copy of the Jquery library that comes with JStree above all other scripts. I believe there may be a patch for Jquery Update that addresses correct script ordering which I will look into.
Issue closed.