Salesforce VisualForce 使用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;
    	}
    }
}
例子2:





public void onlyField()
{
    	
}



你可能感兴趣的:(Visualforce)