You need to sign in to do that
Don't have an account?

Trying to pass a variable from a VF page to Apex to change the results in a component.
I have a page that will display a basket summary, this basket will be used on several pages showing different results based on a variable i am trying to send to the controller from the VF page.
VF Page
I have seen many solutions showing parameters being passed but that only seems to work as part of a submit, not on a page render. Is it possible to do it in this way I am trying?
VF Page
<apex:variable var="prodType" value="Cars"/> <c:sfoProductList />Component - sfoProductList
<apex:component controller="sfoHCCTRL"> <apex:repeat value="{!BasketProducts}" var="p"> {!p.Product_Name__c}</br> </apex:repeat> </apex:component>/>Controller
public String prodType{get; set;} public List<Order_Product__c> getBasketProducts() { List<Order_Product__c> prodList = [SELECT ID, Product_Name__c, Type__c FROM Order_Product__c WHERE Type__c = :prodType]; return prodList; }The value of prodType is set to Cars on the VF page, and is sent to the component ok. When the controller returns the list the value is blank.
I have seen many solutions showing parameters being passed but that only seems to work as part of a submit, not on a page render. Is it possible to do it in this way I am trying?
Why don't you try create an inputtext and bind that with the variable prodType. then onchange rerender the component to see if the component now take the parameter which is value of the input text
Thx