You need to sign in to do that
Don't have an account?

i tried to search values from a object without command button,while typing in the textbox itself,it should return the record..
My code is
Controller:
public class SearchNoButton{
public String find { get; set; }
public list<Customer__c> cuslist{get;set;}
public String searchtext{get;set;}
public string s ;
public void find()
{
cuslist=new list<Customer__c>();
s = '%' + searchtext + '%';
cuslist=
[select Name,Name__c,Status__c,age__c from Customer__c where Name__c LIKE : s];
}
}
visualforce page:
<apex:page controller="SearchNoButton" action="{!find}">
<apex:pageblock title="search Customer">
<apex:form Rendered="{!find}">
name <apex:inputtext value="{!searchtext}" Rendered="{!find}"/>
</apex:form>
</apex:pageblock>
<table border='1' width='100%'>
<tr>
<th>name</th><th>customername</th><th>Status</th><th>AGE</th>
</tr>
<apex:repeat value="{!cusList}" var="a">
<tr>
<td>{!a.Name}</td>
<td>{!a.Name__c}</td>
<td>{!a.Status__c}</td>
<td>{!a.Age__c}</td>
</tr>
</apex:repeat>
</table>
</apex:page>
Controller:
public class SearchNoButton{
public String find { get; set; }
public list<Customer__c> cuslist{get;set;}
public String searchtext{get;set;}
public string s ;
public void find()
{
cuslist=new list<Customer__c>();
s = '%' + searchtext + '%';
cuslist=
[select Name,Name__c,Status__c,age__c from Customer__c where Name__c LIKE : s];
}
}
visualforce page:
<apex:page controller="SearchNoButton" action="{!find}">
<apex:pageblock title="search Customer">
<apex:form Rendered="{!find}">
name <apex:inputtext value="{!searchtext}" Rendered="{!find}"/>
</apex:form>
</apex:pageblock>
<table border='1' width='100%'>
<tr>
<th>name</th><th>customername</th><th>Status</th><th>AGE</th>
</tr>
<apex:repeat value="{!cusList}" var="a">
<tr>
<td>{!a.Name}</td>
<td>{!a.Name__c}</td>
<td>{!a.Status__c}</td>
<td>{!a.Age__c}</td>
</tr>
</apex:repeat>
</table>
</apex:page>
Try to follow this example:
http://sfdcsrini.blogspot.com/2014/08/simple-ajax-example-using-visualforce.html
Please, If this anwser help you mark as the best