You need to sign in to do that
Don't have an account?
Raju kanoperi
Build a serach page in visualforce page
how to build a search like google serach in visualforce page. for example i am serching something like "salesforce materials" in visualforce page dirctly go to that page ..please help me ..
thanks
thanks
Please see below sample code.
Also below are some of the useful links for search functionality.
http://blog.jeffdouglas.com/2010/07/13/building-a-dynamic-search-page-in-visualforce/
https://developer.salesforce.com/docs/atlas.en-us.knowledge_dev.meta/knowledge_dev/knowledge_customize_searchpage_visualforce.htm
http://gtr.net/how-to-build-a-simple-search-page-using-visualforce/
Hope this helps you!
Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution. If you felt I went above and beyond, you can give me kudos.
Thanks and Regards
Sandhya
Change your visual force page as below.
Hope this helps you!
Thanks and Regards
Sandhya
Please check bellow code .
Regards,
Harish.R
public with sharing class searchcontroller {
public list <contact> con {get;set;}
public string searchstring {get;set;}
public searchcontroller( ) {
}
public void searchContact(){
string searchquery='select name,id from contact where name like \'%'+searchstring+'%\' Limit 20'; // querying form contact to retrive the user input keywork
con= Database.query(searchquery);
}
public void clear(){
con.clear();
}
}
Take a look at the code for the Visualforce page to check the output:
<apex:page Controller="searchcontroller" >
<apex:form >
<apex:inputText value="{!searchstring}" label="Input"/>
<apex:commandButton value="Search Contact" action="{!searchcontact}"/>
<apex:commandButton value="Clear records" action="{!clear}"/>
<apex:pageBlock title="Contact Search Result">
<apex:pageblockTable value="{!con}" var="a">
<apex:column value="{!a.name}"/>
<apex:column value="{!a.id}"/>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>