为什么 JQueryUI 不适用于 salesforce 标准输入元素?
我在将 JQueryUI 与 salesforce 标准元素一起使用时遇到问题。基本上,我想自动向用户建议记录名称,而不是用户单击 salesforce 搜索按钮。
<apex:inputField value="{!MyRecord.ChildRecord__c}" id="inpId" required="true/>
<script>
jq$(document.getElementById('{!$Component.inpId}')).autocomplete( {
minLength: 2,
autoFocus: true,
source: mySource
});
</script>
因此,我想知道是否有人尝试将 JQueryUI 与标准 salesforce 输入元素一起使用。就我而言,JQueryUI 事件不会针对 salesforce 元素触发。
I am having trouble using JQueryUI with salesforce standard elements. Basically, I want to auto suggest the record names to the user, instead of the user clicking on the salesforce search button.
<apex:inputField value="{!MyRecord.ChildRecord__c}" id="inpId" required="true/>
<script>
jq$(document.getElementById('{!$Component.inpId}')).autocomplete( {
minLength: 2,
autoFocus: true,
source: mySource
});
</script>
Therefore, I want to know if anyone attempted to use JQueryUI with standard salesforce input elements. In my case, the JQueryUI events are not firing for salesforce elements.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
{!$Component.[elementid]}
并不总是适合我;我不知道为什么。我更喜欢使用属性结尾选择器(http://api.jquery.com/属性结尾带有选择器/)。尝试这样的事情:
控制器:
希望有帮助,
马特
{!$Component.[elementid]}
doesn't always work for me; I'm not sure why. I prefer to use the Attribute Ends With Selector (http://api.jquery.com/attribute-ends-with-selector/).Try something like this:
Controller:
Hope that helps,
Matt
我找出了 JQeuryUI 无法在 SalesForce 标准输入元素上工作的原因。我试图在输入元素上使用 JQueryUI 自动完成功能。应该调用的操作函数没有被调用,因为我没有
设置立即= true属性,以便立即调用操作函数。如果我们没有设置此属性,SalesForce 会尝试验证所有标准输入元素,如果验证失败,则永远不会调用操作函数。
I figured out the reason why JQeuryUI was not working on SalesForce standard input element. I was trying to use JQueryUI autocomplete on the input element. The action function that was supposed to be invoked was not called because I did not have
That is we must have immediate=true attribute set so that action function is called immediately. If we do not have this attribute set, SalesForce tries to validate all the standard input elements and if the validation fails, action function is never called.