分类目录

链接

2021 年 4 月
 1234
567891011
12131415161718
19202122232425
2627282930  

近期文章

热门标签

新人福利,免费薅羊毛

现在位置:    首页 > Salesforce > 正文
Salesforce VisualForce 使用apex:actionFunction调用后台方法
Salesforce 暂无评论 阅读(94)
  1. <apex:inputHidden id="flag" value="{!flag}"/>
  2. <apex:actionFunction action="{!searchCon}" name="searchCon1" oncomplete="return savemessage()" reRender="form1">
  3. <apex:param name="uname" assignto="{!username}" value=""/>
  4. <apex:param name="pword" assignto="{!password}" value=""/>
  5. </apex:actionFunction>
  6.  function savemessage()
  7.  {   
  8.             if(document.getElementById("page:form1:flag").value == "false"){
  9.                 alert("用户名密码错误!");
  10.                 return false;
  11.             }
  12.             else
  13.             {
  14.                 window.location.href="/apex/UserInformationPage";
  15. }
  16. }
  17. function save()
  18. {
  19.         searchCon1(document.getElementById('Username_pop').value,document.getElementById('Password_pop').value);
  20. }
  1.  
  2. 后台类
  3. global class GYZ_UserLoginController 
  4. {
  5.     public ContractNew__c[] clist{get;set;}
  6.     public Boolean flag{get;set;}
  7.     public String username{get;set;}
  8.     public String password{get;set;}
  9.  
  10.     global GYZ_UserLoginController() 
  11.     {
  12.         clist = new ContractNew__c[]{};
  13.     }
  14.  
  15.     global void searchCon()
  16.     {
  17.         clist = [Select id From ContractNew__c Where GYZ_UserName__c =:username and GYZ_Password__c =: password];
  18.         System.debug();
  19.         if(clist.size() > 0)
  20.         {
  21.             flag = true;
  22.         }
  23.         else
  24.         {
  25.             flag = false;
  26.         }
  27.     }
  28. } 

============ 欢迎各位老板打赏~ ===========

【上篇】
【下篇】

本文版权归Bruce's Blog所有,转载引用请完整注明以下信息:
本文作者:Bruce
本文地址:Salesforce VisualForce 使用apex:actionFunction调用后台方法 | Bruce's Blog

发表评论

留言无头像?