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
Jim BoudreauxJim Boudreaux 

Does the 'assignto' attribute of apex:param actually do anything?

ok, as I understand it,
 
Code:
<apex: param assignto="{!resultid}" value="123"/>
should assign the value, in this case "123" to the setter method setResultID() in the controller right?
 
 
Well it doesn't.
 
Code:
Apex: 
public string resultid; 
public string getResultId(){ return resultid; } 
public void setResultId(string id){ this.resultid = id; } 

VF: 
<apex:outputpanel id="result> 
   {!resultid} 
</apex:outputpanel>
<apex:outputlabel>
   <apex:actionsupport event="onclick" action="{!myretrieve}" rerender="result" status="status">
     <apex:param assignto="{!resultid}" value="123"/> 
   </apex:actionsupport> 
   Click Me 
</apex:outputlabel> 

 
Shouldn't clicking this outputlabel result in the {!resultid} displaying "123"?
Ron HessRon Hess
Hi Jim
your code is missing a quote after id="result



The code below works fine with no controller at all.

Code:
<apex:page >
<apex:form>
<apex:outputpanel id="result" >
{!resultid}
</apex:outputpanel>
<apex:outputlabel>
<apex:actionsupport event="onclick" rerender="result" status="status">
<apex:param assignto="{!resultid}" value="123" />
</apex:actionsupport>
Click Me
</apex:outputlabel>
</apex:form>
</apex:page>

 
This shows that the controller is not needed, resultid is created for you, and filled in and the result output panel shows the number 123 when i click on the label.



Now when i add a controller:
Code:
public class tryparam {
    public string resultId { 
get;
set { resultid = value; system.debug( 'set result id '+resultid); }
} }

 

it continues to work, and my debug log ( System Log) does show the debug statement with the correct value.



Message Edited by Ron Hess on 01-07-2009 10:39 AM
jeremyajohnsonjeremyajohnson
Can you please provide an example of this working within any type of list?  I've tried dataTable, pageBlockTable, repeat, and dataList.