• PeachTree
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies

I have created an input field in visualforce which displays some search results when a button (named search) is clicked. I am able to write the apex code to display the results. However, I want to display the search results in a new pop-up window . I have read this post and was able to create a pop up window. 

http://www.salesforcegeneral.com/salesforce-modal-dialog-box/

 

This is my visualforce code which produces search results. 

 

<apex:page sidebar="false" showHeader="false" standardController="Account" extensions="SearchSuiteNumber">
<p>Enter the account number to search</p>
<apex:form >
<apex:pageBlock mode="edit" id="block">
<apex:pageBlockSection >
<apex:pageBlockSectionItem >
<apex:panelGroup >
<apex:inputText id="searchText" value="{!searchText}"/>
<apex:commandButton value="Search" action="{!search}" rerender="block" status="status"/>
</apex:panelGroup>
</apex:pageBlockSectionItem>
</apex:pageBlockSection><br/>

<apex:actionStatus id="status" startText="Searching... please wait..."/>
<apex:pageBlockSection title="Search Results" id="resultsBlock" columns="1">
<apex:pageBlockTable value="{!searchResults}" var="item" rendered="{!NOT(ISNULL(searchResults))}">
<apex:column value="{!item.Name}" headerValue="Customer" width="30"/>
<apex:column value="{!item.Acc_Num__c}" headerValue="Account Number" width="35"/>
</apex:pageBlockTable>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>

 

Apex Class:

 

public with sharing class SearchAccountNumber {

private ApexPages.StandardController controller {get; set;}
public List<Account> searchResults {get;set;}
public string searchText {get;set;}

public SearchAccountNumber(ApexPages.StandardController controller) { }

// fired when the search button is clicked
public PageReference search()
{
String qry = 'select id, Name, Acc_Num__c from Account WHERE Acc_Num__c LIKE \'%'+searchText+'%\'';
searchResults = Database.query(qry);
return null;
}
}

 

Please help as this issue is urgent for me. 

 

Thanks a lot.

Hi all,I want to display a popup window in vvisualforce page.on click on the image need to display an popup in visual force page,.