1

I have two Visualforce components.

One is CompleteArticleSearch, Where a Search Text Box and

The second is CompleteArticleResultShow, where searched article will display.

How can I pass search text value from CompleteArticleSearch component to CompleteArticleResultShow.

CompleteArticleSearch Component

    <apex:component controller="ArticleSearchText" id="SearchBoxComponent">
    <apex:attribute access="public" id="InputSearch" name="InputText" description="Enetr Description here." type="String"/>

      <apex:form >
            <apex:pageBlock title="Search" id="pageblockid" >
                <apex:inputText value="{!searchq}" id="theSearchstring" maxlength="100" size="110" />
                <apex:actionSupport event="onblur"/>
                    &nbsp;
            </apex:pageBlock>
    </apex:form>
    </apex:component>

CompleteArticleResultShow Component

 <apex:component controller="vfKeywordSearchController1">
    <apex:attribute access="public" id="attributefromsearch" name="SearchArticle" type="string" assignTo="{!searchstring}"  description="Text from Text box to search string." />
    <style>
    td{
    vertical-align : top;
    text-align: left;
    }
    </style>
        <apex:form >

            <apex:pageBlock title="Article List" rendered="{!searchstring!=null}">
                <apex:panelGroup id="theSearchResults" >
                    <apex:panelGrid width="100%">
                        <table width="99%">
                            <tr>
                                <th width="33%" align="left">Title</th>
                            </tr>
                        </table>
                <knowledge:articleList articleVar="article" id="results" pageNumber="{!currentPageNumber}" Keyword="{!searchstring}" hasMoreVar="false" pageSize="10" >
                    <table width="99%">
                        <tr>
                            <td width="33%">
                                <apex:outputLink target="_blank" value="{!URLFOR($Action.KnowledgeArticle.View,article.id,['popup' = 'true'])}">{!article.title}</apex:outputLink>
                            </td>
                        </tr>
                    </table>
                </knowledge:articleList>
            </apex:panelGrid>
                <apex:panelGrid columns="2">
                    <apex:commandLink action="{!previous}" value="Previous" style="{!IF(prevRequired =true,'display:block','display:none')}" reRender="theSearchResults"/>
                    <apex:commandLink action="{!next}" value="Next" style="{!IF(nextRequired =true,'display:block','display:none')}" reRender="theSearchResults"/>
                </apex:panelGrid>
                </apex:panelGroup>
            </apex:pageBlock>
        </apex:form>
    </apex:component>
  • Are both your components added to a VF page ? – Amit Bangad Aug 14 '15 at 12:35
  • Yes i have added both components in VF page. – V T Aug 14 '15 at 14:23
  • It appears to me that the first component generates the Keyword="{!searchstring}" used by the second component. – crmprogdev Aug 14 '15 at 15:04
  • yes @ crmprogdev – V T Aug 17 '15 at 7:49
  • Does this help at all? developer.salesforce.com/page/… – Eric Aug 17 '15 at 14:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.