+ Start a Discussion
Yousef ShanawanyYousef Shanawany 

apex:param assignto is not passing any values

Hello,

 

I am trying to pass a value from the visualforce page to my apex code. I am using the <apex:param assignto to pass values, but nothing gets updated when I run the action.

 

<apex:dataList value="{!sameCategoryContents}" var="content" styleClass="slides" id="slider2">
<apex:commandLink rerender="page:player-container" action="{!updateCurrentContent}">
<apex:param value="TEST" assignTo="{!currentContentId}" />
<apex:image value="{!content.Sm_Image_URL__c}"
style="width:175px;height:95px; border-radius: 7px; cursor:pointer;" title="{!content.name}" >
</apex:image>
</apex:commandLink>
</apex:dataList>
</apex:outputPanel>

 

And I set the variable in my apex:code

 

    public String currentContentId {get; set;}

 

But I keep clicking on the link in the visualforce but the variable never ever gets updated. Thank you.

MTBRiderMTBRider

I just went through this myself.  Try something like this this:

 

<apex:outputPanel id="op">
   <apex:commandLink value="TEST" action="{!updateCurrentContent}" >
      <apex:param name="id" value="{!content.Id}" assignTo="{!currentContentId}"/>
      <apex:actionSupport event="onclick" reRender="page:player-container"/>
   </apex:commandLink>
</apex:outputPanel>

 Basically you need the outputpanel and actionsupport in there.

APathakAPathak

Hi,

Please check if this works

 

<apex:outputPanel id="oPanel">
	<apex:dataList value="{!sameCategoryContents}" var="content" styleClass="slides" id="slider2">
		<apex:commandLink rerender="oPanel" action="{!updateCurrentContent}">
			<apex:image value="{!content.Sm_Image_URL__c}" style="width:175px;height:95px; border-radius: 7px; cursor:pointer;" title="{!content.name}" >
			</apex:image>
			<apex:param value="TEST" assignTo="{!currentContentId}" name="testParam"/>
		</apex:commandLink>
	</apex:dataList>
</apex:outputPanel>

 

Thanks