Salesforce actionSupport InputText Onchange未触发
我正为此绞尽脑汁。这是一个简单的on-change函数,应该会启动,但是当我在我的组织中测试时,我从来没有得到调试“here”,尽管在我的类中得到了其余的。我查看了几十个不同的谷歌搜索结果,代码是相同的。有人知道SF是否刚刚坏了吗Salesforce actionSupport InputText Onchange未触发,salesforce,apex-code,visualforce,Salesforce,Apex Code,Visualforce,我正为此绞尽脑汁。这是一个简单的on-change函数,应该会启动,但是当我在我的组织中测试时,我从来没有得到调试“here”,尽管在我的类中得到了其余的。我查看了几十个不同的谷歌搜索结果,代码是相同的。有人知道SF是否刚刚坏了吗 public class testController { public static String testNewString {get;set;} public testController(){} public static Boo
public class testController {
public static String testNewString {get;set;}
public testController(){}
public static Boolean isAccountAvailable()
{
System.debug('here');
List<Account> tempList = ([SELECT Id
FROM Account
WHERE Name = :testNewString]);
if(tempList.size() != 0)
{
return true;
}
else
{
return false;
}
}
}
<apex:page controller="testController" docType="html-5.0">
<apex:form id="form1">
<apex:inputText value="{!testNewString }" html-placeholder="New Sales Order #">
<apex:actionSupport event="onChange" action="{!isAccountAvailable}" rerender="form1" />
</apex:inputText>
</apex:form>
</apex:page>
公共类testController{
公共静态字符串testNewString{get;set;}
公共testController(){}
公共静态布尔值isAccountAvailable()
{
System.debug('here');
列表模板列表=([选择Id
从帐户
其中Name=:testNewString]);
如果(templast.size()!=0)
{
返回true;
}
其他的
{
返回false;
}
}
}
无论是谁在寻找答案,这段代码片段的修复都很微妙。确保函数返回一个页面引用。将字段设置为全局可能有助于使其对VF可见
public class TestController {
public String testNewString {get;set;}
public testController(){}
public PageReference isAccountAvailable()
{
System.debug('here');
List<Account> tempList = ([SELECT Id
FROM Account
WHERE Name = :testNewString]);
if(tempList.size() != 0)
{
System.debug('true');
}
else
{
System.debug('false');
}
return null;
}
}
<apex:page controller="TestController" docType="html-5.0">
<apex:form id="form1">
<apex:inputText value="{!testNewString}" html-placeholder="New Sales Order #">
<apex:actionSupport event="onchange" action="{!isAccountAvailable}" rerender="form1" />
</apex:inputText>
</apex:form>
</apex:page>
公共类TestController{
公共字符串testNewString{get;set;}
公共testController(){}
公共页面引用isAccountAvailable()
{
System.debug('here');
列表模板列表=([选择Id
从帐户
其中Name=:testNewString]);
如果(templast.size()!=0)
{
System.debug('true');
}
其他的
{
System.debug('false');
}
返回null;
}
}