function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
One_Kitchen_GuyOne_Kitchen_Guy 

Who can explain this weird issue with <apex:repeat/> and <apex:commandButton/>?

Hi guys,
For some reason my search buttons are working when generated individually, howver when generated with the <apex:repeat/> method they dont work. Can anyone please advise?

I am trying to modify an "Opportunity Produt Entry Replacement" plugin which I installed from http://www.michaelforce.org/recipeView?id=a0G30000006eVxVEAU .

The problem I am running into is when I try to generate buttons in tabbed groups using the <apex:repeat> method that builds off a list in my controller. The buttons are supposed to pass  its value to the query string and return the products that match the search. The weird thing is that the buttons generated without the repeat method work as intended however the buttons generated via the repeat method do not.

Anybody have any ideas? Thanks in advance!

|------------------------------------Visualforce Page----------------------------------|

<!--These Buttons Work-->
    <apex:tab label="Package" name="package" id="packageTab">
        <apex:commandButton value="Reface Wood" reRender="searchResults" action="{!updateAvailableList}">
            <apex:param assignTo="{!searchString}" value=" RWD "/>
        </apex:commandButton>
        <apex:commandButton value="New Laminate" reRender="searchResults" action="{!updateAvailableList}">
            <apex:param assignTo="{!searchString}" value=" NLAM "/>
        </apex:commandButton>
        <apex:commandButton value="New Wood" reRender="searchResults" action="{!updateAvailableList}">
            <apex:param assignTo="{!searchString}" value=" NWD "/>
        </apex:commandButton>
        <apex:commandButton value="New Wood" reRender="searchResults" action="{!updateAvailableList}">
            <apex:param assignTo="{!searchString}" value="Wood"/>
        </apex:commandButton>
        <apex:commandButton value="Laminate" reRender="searchResults" action="{!updateAvailableList}">
            <apex:param assignTo="{!searchString}" value="laminate"/>
        </apex:commandButton>
    </apex:tab>

<!--These buttons do not-->
    <apex:repeat value="{!dDFMatBtns}" var="d">
        <apex:commandButton value="{!d}" reRender="searchResults" action="{!updateAvailableList}">
            <apex:param assignTo="{!searchString}" value="{!d}"/>
        </apex:commandButton>
    </apex:repeat>


|-------------------------------------Controller------------------------------------------|
if(searchString!=null){
    qString+= ' and (Product2.Name like \'%' + searchString + '%\' or Product2.Description like \'%' + searchString + '%\' or Product2.Keyword__c like \'%' + searchString + '%\' or Product2.Family like \'%' + searchString + '%\' or Product2.Product_Brand__c like \'%' + searchString + '%\')';
}

searchString = null;
system.debug('qString:' +qString);

AvailableProducts = database.query(qString);

// We only display up to 100 results... if there are more than we let the user know (see vf page)
if(AvailableProducts.size()==301){
    AvailableProducts.remove(300);
    overLimit = true;
}else{
    overLimit = false;
}

public List<String> dDFStyleBtns{
    get{
        if(dDFStyleBtns == null){
            dDFStyleBtns = new List<String>();
            dDFStyleBtns.add('Amesbury');
            dDFStyleBtns.add('CRP');
            dDFStyleBtns.add('Elite');
            dDFStyleBtns.add('Euro');
            dDFStyleBtns.add('Lasalle');
            dDFStyleBtns.add('Madison');
            dDFStyleBtns.add('Presidential');
            dDFStyleBtns.add('TW-10');
            dDFStyleBtns.add('Prestige');
            dDFStyleBtns.add('Windham');
            dDFStyleBtns.add('Yardley');
        }
        return dDFStyleBtns;
    }
    private set;
}
Ashish_SFDCAshish_SFDC
Hi , 


Can you post an Image of the result page to understand the behavior. 


Regards,
Ashish