+ Start a Discussion
Karthik TathiReddyKarthik TathiReddy 

Does the apex:param assigned value is usable only with the commandlink and commandButton actions?

Hi,

I am using a check box and passing many param id's for the check box to the controller which is assigned to the multiple values corresponding to the different params. While I am using the assigned values in different methods in the controller, I am getting null values in the debug logs/ console.

 

Could any one help with your ideas how do I use them in different methods through out the controller....

vbsvbs
There is no apex:param component support for checkboxes. Depending on how you have bound the checkboxes fields to the controller will determine how the values are being passed across.
Can you post some code so that we can have a look?
Karthik TathiReddyKarthik TathiReddy
The following is the code I am using for my VF page.

<apex:inputCheckbox value="{!isChecked}" id="referLabel"  styleClass="referLabel" >
	<apex:actionSupport event="onclick" action="{!create}" status="Status">
	<apex:param name="fid" value="{!fly.id}" assignTo="{!refId}"/>
	<apex:param name="sorRefd" value="{!pw.trans.id}" assignTo="{!sorRefId}"/>
	<apex:param name="service" id="locservice" value="{!pw.trans.services__c}" assignTo="{!servicesRefId}"/>
	</apex:actionSupport>
</apex:inputCheckbox>


===================
Here the assigned values I can use while performing the actions from the controller.
Now my question is how can I use those assigned values in various methods in the controller?

 

vbsvbs
Karthik - Assuming these are top level class variables with a accessibility to getter and setter the variables are now set on click and available for use across the controller methods. Are you haveing issues accessing these in the controller? If so, please post the controller code.
Karthik TathiReddyKarthik TathiReddy
public class DetailPage{
public ID servicesRefId{get;set;}
public ID sorRefId{get;set;}

public void getDetails(){
Account acc = new Account();
acc=[SELECT Name FROM Account WHERE Source__c=:sorRefId AND Services__c=:servicesRefId];
System.debug('Source='+acc[0].Source__c);
System.debug('Services='+acc[0].Services__c);
//////////////// Here the value in the debug logs are showing null.
//////////////// Even I tried of debuging the param values.. i.e., System.debug('services are='+servicesRefId+'Source is='+sorRefId);  ///////////// Even these //////////////// values are showing null.
}
public Pagereference create(){
        insert new Recommendations__c(Services__c=servicesRefId, Opportunity__c=opps.id, Source__c=sorRefId,                    
        Venue_Pricing_Info__c=venuePricingInfoRefId);
	  getPricingWrapper();
	  return null;
    }

}



Can you please tell me how can we use them outside the action methods...

 

Avidev9Avidev9
Karthik seems like you are pretty close.
Can you add a rerender to your action support ?

generally param doesnt work without a rerender
Karthik TathiReddyKarthik TathiReddy

I am using output panel for the checkbox and rerendering it. But i am unable to use the assigned param value outside the outputpanel in the vf page. I am unable to get the assigned value in the controller except in the action region for the outputpanel.

 

Is there any way of using the assigend value else where in the controller? 

vbsvbs
@Karthik - I cant see a rerender on the actionSupport. How are you rerendering the panel? The key here is that the form data needs to be sent across to the server which wont work without submission or rerendering...
Karthik TathiReddyKarthik TathiReddy
<apex:inputCheckbox value="{!isChecked}" id="referLabel"  styleClass="referLabel" >
	<apex:actionSupport event="onclick" action="{!create}" rerender="headerComponent,repeatList" status="Status">
	<apex:param name="fid" value="{!fly.id}" assignTo="{!refId}"/>
	<apex:param name="sorRefd" value="{!pw.trans.id}" assignTo="{!sorRefId}"/>
	<apex:param name="service" id="locservice" value="{!pw.trans.services__c}" assignTo="{!servicesRefId}"/>
	</apex:actionSupport>
</apex:inputCheckbox>

 I am rerendering the outputpanel as shown in the code. Finally I am concluding that we can not use the assigned param values any where in the VF page except the region we used.