+ Start a Discussion

Is it possible to manipulate an attribute from a component controller?

I have a component that has a value passed into it from a VF page. The attribute is then passed into the components controller where the value needs to change. Is there any way to get this value back to the main page?
Brendan LallyBrendan Lally
your ? isn't that clear - give us an example - Matey!
How is the component controller called (is it an extension or standard)?
How is this attribute ('list') getting 'called' {!list}?

if u modify that 'list' in your controller then that (data) model is available whenin your (VF) page for processing/displaying
u can loop on that 'list', do conditional displays/renders etc..
but I'm presuming u know that

Hi Brendan,

Basically I have a variable in a page controller. It's loaded in from a custom object record and it's just a string. I have a custom component which I pass the variable to like:

<c:mycomponent attribute1="{!myValue}"/>

I need to do some processing on it based on what is going on in the component so I pass it into the component controller using assignTo. From here I can do all my processing but there doesn't seem to be any way to return the value back to the main page.

Brendan LallyBrendan Lally
gotya now.
So its 'in the component' where u need 2 make changes and then get that related back in the VF page (which called it in the first place)

Not done much with components so dont' know there.

I'd suggest getting your controller to take the modified string value in the component {!save_my_value} , save that away via a setter and then 'recall' that value in the VF page {!get_back_saved_value}

Just an idea.

It's never getting set in the page controller. It would appear that AssignTo passes it by value rather than by reference as the page does to the attribute. You end up with a copy of the value in your component controller and no way to get anything back to the page.
Brendan LallyBrendan Lally
awhh.. don't sound 2 good.
If u've tried it several ways I'd raise a call with SF as a potential bug

Take a look at this post for a very related discussion and example markup/code.

Message Edited by dchasman on 10-16-2008 02:13 PM

Message Edited by dchasman on 10-16-2008 02:45 PM