现在位置:
首页 > Salesforce > 正文
Salesforce VisualForce 使用apex:actionFunction调用后台方法
- <apex:inputHidden id="flag" value="{!flag}"/>
- <apex:actionFunction action="{!searchCon}" name="searchCon1" oncomplete="return savemessage()" reRender="form1">
- <apex:param name="uname" assignto="{!username}" value=""/>
- <apex:param name="pword" assignto="{!password}" value=""/>
- </apex:actionFunction>
- function savemessage()
- {
- if(document.getElementById("page:form1:flag").value == "false"){
- alert("用户名密码错误!");
- return false;
- }
- else
- {
- window.location.href="/apex/UserInformationPage";
- }
- }
- function save()
- {
- searchCon1(document.getElementById('Username_pop').value,document.getElementById('Password_pop').value);
- }
- 后台类
- global class GYZ_UserLoginController
- {
- public ContractNew__c[] clist{get;set;}
- public Boolean flag{get;set;}
- public String username{get;set;}
- public String password{get;set;}
- global GYZ_UserLoginController()
- {
- clist = new ContractNew__c[]{};
- }
- global void searchCon()
- {
- clist = [Select id From ContractNew__c Where GYZ_UserName__c =:username and GYZ_Password__c =: password];
- System.debug();
- if(clist.size() > 0)
- {
- flag = true;
- }
- else
- {
- flag = false;
- }
- }
- }
============ 欢迎各位老板打赏~ ===========
与本文相关的文章
- · How to Call Salesforce API from Lightning Component
- · apex highlight userDefineLang for notepad++
- · 详解 Salesforce 15 和 18 位的ID
- · Salesforce Test class注意事项
- · salesforce Milestone clock is not running
- · salesforce apex traced the number of query
- · salesforce antscript无法拉取完整的profile
- · salesforce lightning report取URL参数
- · salesforce test class用现有数据测试
- · salesforce report get url parameters
- · salesforce display trigger error
- · salesforce发送email