You need to sign in to do that
Don't have an account?
Force.platform
display pageBlock only after click button
Hello All,
I have vf page, on this i have search functionality, when i enter any product name in serch box then related products display in pageBlock in table format. but requirement, this pageBlock should dispaly only after when we click on search button, not before.
below is my code,
<apex:commandButton value="Clear Products" action="{!clear}" style="float:right;" reRender="panel"/>
<apex:commandButton value="Search Products" action="{!search}" style="float:right;"/>
<apex:inputText value="{!searchstring}" label="Input" style="float:right;"/>
<!-- pageBlockTable for search result-->
<apex:outputPanel id="panel">
<apex:pageBlock title="Search Result">
<apex:pageblockTable value="{!SerchPro}" var="a">
<apex:column headerValue="Product Name">
<apex:outputLink title="View Product Detail" onclick="return openPopUp('{!a.id}') ">
{!a.name}
</apex:outputLink>
</apex:column>
<!-- <apex:column value="{!a.Quantity__c}"/>-->
<apex:column >
<apex:commandLink value="Add to Bucket" action="{!AddToCartButton}">
<apex:param name="PQuantity" value="{!a.Quantity__c}"/>
<apex:param name="PId" value="{!a.Id}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:outputPanel>
I have vf page, on this i have search functionality, when i enter any product name in serch box then related products display in pageBlock in table format. but requirement, this pageBlock should dispaly only after when we click on search button, not before.
below is my code,
<apex:commandButton value="Clear Products" action="{!clear}" style="float:right;" reRender="panel"/>
<apex:commandButton value="Search Products" action="{!search}" style="float:right;"/>
<apex:inputText value="{!searchstring}" label="Input" style="float:right;"/>
<!-- pageBlockTable for search result-->
<apex:outputPanel id="panel">
<apex:pageBlock title="Search Result">
<apex:pageblockTable value="{!SerchPro}" var="a">
<apex:column headerValue="Product Name">
<apex:outputLink title="View Product Detail" onclick="return openPopUp('{!a.id}') ">
{!a.name}
</apex:outputLink>
</apex:column>
<!-- <apex:column value="{!a.Quantity__c}"/>-->
<apex:column >
<apex:commandLink value="Add to Bucket" action="{!AddToCartButton}">
<apex:param name="PQuantity" value="{!a.Quantity__c}"/>
<apex:param name="PId" value="{!a.Id}"/>
</apex:commandLink>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:outputPanel>
This is the Code for "Searching Products by entering Name",
It will show all products as per your requirement
When you will click on search button, then it will show all related products.
//Controller
//VF Page
You Can Make Changes as per your requirement in this code
Hope this will meet your requirement
If this helps you, Please Mark this answer as Best Answer
Regards
Suraj
My requirement is, i want to show pageBlock only when i enter any product name in searchbox and click on serach button. before searching there should nothing display pageBlock on page
Sorry for the late reply,
Please Try this Code, Maybe now it will solve your problem
//Controller
//VF Page
If this code helps you to render your pageblock only after click of search button, then please don't forget to mark this answer best
so this question will removed from unsolved threads
Regards
Suraj