You need to sign in to do that
Don't have an account?

Modifying Visual Force Component Attributes, ie changing rendered value...
Okay, I searched and couldn't find this so Im gonna have to ask. Im building a VF page and I would like to keep certain things hidden and then unhide them based on the results of SOQL query's or code in the controller.
I have an inputText component that the user uses to search with and a hidden selectList that I only want to be visible if the search returns more than one result. Can I set this like I would an asp.net component in the controller or do I have to do this via JS somehow? I have some other lists and fields I would like to do this with as well.
here is my code so far:
VF:
<apex:selectList id="dealerSelect" value="{!initStr}" size="1" disabled="true" rendered="false"> <apex:selectOptions value="{!dealers}" /> </apex:selectList>
Controller:
if(dealerIDs.Size() > 1){ //pageRef. ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, 'From Name: ' + dealerIDs[1].Name)); } } catch(Exception e){ ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING, 'Error' + e)); }
The messages are there as references for myself right now.
Thank you!
Hi,
You need to define a boolean attribute in your controller class with default getter setter.
Then in VF page, do the changes as highlighted.
Then you can changes the boolean value in DisplaySelectList variable at particular place.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
chamil's blog
All Answers
Change the rendered='false' to rendered='{!showList}' and add a boolean controller property showList that determines whether the list is to be shown or not.
Hi,
You need to define a boolean attribute in your controller class with default getter setter.
Then in VF page, do the changes as highlighted.
Then you can changes the boolean value in DisplaySelectList variable at particular place.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
chamil's blog
Oh man, thank you both! :)