You need to sign in to do that
Don't have an account?
Steve Chadbourn
I get an error of Unknown property MyController.myClient.
How to use apex:param and assignTo
I'm using a param component nested inside a commandLink and want to set a controller variable to its value but I can't seem to get it to work.
Here is the visualforce code:
Code:
<apex:commandLink action="{!test}" value="Select"> <apex:param assignTo="{!myClient}" value="{!client.Full_Name__c}"/> </apex:commandLink>
And here is the controller code:
Code:
public class MyController { String myClient; public void setMyClient(String s) { myClient = s; } }
I get an error of Unknown property MyController.myClient.
Any ideas?
Hi just to start this off, I am learning how to code in VisualForce right now, and I am looking to do almost the same thing.
I am searching the boards for answers and came to your post.
In the help doc it states that param can only be a child of an outPutLink...
"A parameter for the parent component. The param component can only be a child of an outputLink, outputText, or a actionFunction component." taken from the apex page components page.
I see you are using a commandLink, try using the outPutLink.
Please post a reply if that worked or not.
Message Edited by dchasman on 03-22-2008 07:06 AM
Thanks I'll give that a try.
Mikef - there is an error in the Visualforce documentation. On page 161 it does indeed specify that param can only be a child of an outputLink or outputText component. On page 24 though it specifies that param can be incuded in other tags such as include, commandButton and commandLink.
While I don't get an error anymore thanks to adding a getter, I am getting strange behaviour so I'll explain what I'm trying to do and show how I'm attempting it and hopefully someone can correct my code or come up with a better way to do it.
I need to display a list of client information (ultimately returned from a web service) and allow the user to select one of the rows.
I have created a custom object with 3 fields, all text.
Here is the controller code:
and here is the page:
All appears OK but the param does not seem to assign the value correctly. If I select the first row the output panel updates correctly with "Fred Jones". If I refresh the page and try and select the second row, The value remains as <None>.
I thought initially that the command button or the param was not getting the correct client value but all works with the first row, just not the second.
Any ideas?
Message Edited by dchasman on 03-27-2008 08:27 AM
Hello, can <apex:param> be used to send a value from VF page to Apex class? Is yes how?
If not? how else can it be done?
using name puts the value into the page parameters which you get back in the controller like this....
What is use of <apex:param>