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
lopezclopezc 

Passing parameter to controller Method not working

Hi,

 

I was wondering if it is possible to pass parameters to our controller method while in a VF page.

I want to render a component only if the method called returns 'true':

 <c:NetworkForm case="{!case}" contact="{!contact}" rendered="{!DisplaySection}">

<apex:param name="sectionName" value="NetworkForm" />   

</c:NetworkForm>

And the method is the following:

 public Boolean getDisplaySection(){

String sectionName = apexpages.currentpage().getparameters().get('sectionName');

System.debug('SECTION NAME::::::::::' + sectionName);  //sectionName is null !!!!

if(listOfCategorySections.size() > 0 && callCategory!=null && sectionName!=null){

List<RF_Section_Map__c> sections = listOfCategorySections.get(calltype+callCategory);

for(RF_Section_Map__c loopSec : sections){

if(sectionName.equalsIgnoreCase(loopSec.Component_Name__c)){

return true;

}

}

}

return false;

}

But the parameter is null in my controller, any ideas?

 

Thanks in advance.

TomSnyderTomSnyder

I want to render a component only if the method called returns 'true':

 

<apex:outputpanel rendered="{!DisplaySection}">

<c:NetworkForm case="{!case}" contact="{!contact}"/>

</apex:outputpanel>

newbiewvfdevnewbiewvfdev

Just in case if you are rerendering this outputPanel on a user interaction, you will have an issue with what u have.  I just had this issue.  If you specify rendered attribute on an outputPanel and if you rerender that tag from a user interaction, let's say button click(CommandLink), It would not rerender properly. You will either need to wrap the outputPanel with another outputPanel, or move the rendered attribute to the c:NetworkForm tag. And put an id for the ouside outputPanel and rerender that outputPanel. It seem you can't rerender a tag that has rendered attribute.