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
rickynrickyn 

Parm and ActionSupport inside Outputlink not working

Hi,

 

I have a Param and ActionSupport Tag inside an Outputlink, and the value I assign is not being passed to the controller.  Any thoughts? Thanks in advance.

 

<apex:outputpanel id="CategoryList">

            <apex:outputlink id="SCLink">{!SCvalue.Name}             
<apex:actionSupport event="onclick" action="{!showSC}" rerender="testtextline"> <apex:param assignTo="{!SelectedCategoryID}" value="{!SCvalue.ID}" name="SelectedCategoryID"/> </apex:actionSupport> </apex:outputlink> </apex:outputpanel> <apex:outputpanel id="testtextline"> <apex:outputtext >Test-{!SelectedCategoryID}</apex:outputtext> <!--Value starts as null and stays null after rerender--> </apex:outputpanel> Controller Snippet Public String SelectedCategoryID {get;set;} public PageReference showSC(){ system.debug('DEBUG: Entered Show SC and SelectedServiceCategoryID = ' + SelectedCategoryID); return null; }

 

bob_buzzardbob_buzzard

What does SCValue.ID equate to when the page is rendered? 

rickynrickyn

They equate to ID's.

 

I managed to get it to work within apex:form tags and the param outside the outputlink tag.  I would like to avoid using the form tag to minimize view state.  Is there any other way?

 

<apex:form >
   <apex:datatable styleclass="NavigationList" width="150%" border="0" cellspacing="0" cellpadding="0" value="{!SCrowWrappers}" var="row">

         <apex:repeat value="{!row.SCvalues}" var="SCvalue" > 
          <apex:column >
            <apex:outputpanel >
            <apex:outputtext id="SCLink">{!SCvalue.Name} </apex:outputtext>
             <apex:actionSupport event="onclick" action="{!showSC}"  rerender="ServiceTaskPanel" status="Working" immediate="True">
               <apex:param assignTo="{!SelectedCategoryID}" value="{!SCvalue.ID}" name="SelectedCategoryID"/> 
             </apex:actionSupport>
             </apex:outputpanel>
             </apex:column>
         </apex:repeat>
</apex:datatable>

  </apex:form>

 

bob_buzzardbob_buzzard

I think you may need the apex:form side of things to allow the apex:param to work correctly with the assignTo attribute.  if you don't want to go that route, it would probably be better to simply construct a full URL as the link, e.g.

 

<apex:outputLink value="/apex/MyPage?SelectedCategoryId={!SCValue.ID}">{!SCvalue.Name}</apex:outputLink>