为什么JQueryUI在Salesforce标准输入元素上不起作用? [英] Why JQueryUI does not work on salesforce standard input elements?

查看:122
本文介绍了为什么JQueryUI在Salesforce标准输入元素上不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法将JQueryUI与Salesforce标准元素一起使用.基本上,我想向用户自动建议记录名称,而不是用户单击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>

因此,我想知道是否有人尝试将JQueryUI与标准salesforce输入元素一起使用.就我而言,对于Salesforce元素,不会触发JQueryUI事件.

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.

推荐答案

我弄清楚了JQeuryUI无法使用SalesForce标准输入元素的原因.我试图在输入元素上使用JQueryUI自动完成功能.没有调用应该被调用的动作函数,因为我没有

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

<apex:actionFunction immediate="true" />

那是我们必须设置Instant = true属性,以便立即调用动作函数.如果没有设置此属性,则SalesForce会尝试验证所有标准输入元素,如果验证失败,则永远不会调用操作函数.

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.

这篇关于为什么JQueryUI在Salesforce标准输入元素上不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆