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
Kristen LundKristen Lund 

Visualforce Code Update

Hello team --
I have a visualforce page created, which I am looking to slightly modify but am new to the coding side of Saleforce and am looking for a little guidance. Within our visualforce page, we have a section which displays a specific list and it works great, however I'd like to update it so it so this list does not appear if a certain picklist value is selected. The current visualforce is below and I'd like to add something such as
<apex:outputlink rendered="[!Object.Field_Name__c != "Media"}"> </apex:outputLink>
to indicate I do not want this list to show up. But I'm not sure where to put this section or if this addition would even get me to what I'm hoping. Any suggestions would be greatly appreciated!

Thanks,
Kristen

<div class="col col-xs-12 thingToDo">
<div class="col col-xs-4 col-sm-2 thingToDoImg">
<apex:outputLink styleClass="" value="{!$Page.List}?id={!currentReservation.Id}&depId={!currentReservation.Departure__c}">
<apex:image value="{!URLFOR($Resource.Images, '/trip-gear-a.jpg')}" />
</apex:outputLink> </div> <div class="col col-xs-8 col-sm-10 thingToDoLink">
<apex:outputLink styleClass="" value="{!$Page.List}?id={!currentReservation.Id}&depId={!currentReservation.Departure__c}">
<div class="vcenter">
<h3>List</h3>
<h4>(View)</h4>
</div> </apex:outputLink>
</div>
</div>

Prateek Singh SengarPrateek Singh Sengar
Hi,
Can you please try replacing the rendered attribute with below
rendered = {! if(Object.Field_Name__c != "Media", false, true)}


 
Kristen LundKristen Lund
Thanks for the note, Prateek - I tried adding the sting as noted, as well as

<apex:outputLink rendered ="{! if(Object.Field_Name__c != "Media", false, true)}"> </apex:outputLink>

But I keep getting errors The element type "apex:outputLink" must be terminated by the matching end-tag "</apex:outputLink>".
I am ending the opening of the apex Link, so I'm not sure what the issue is.
Prateek Singh SengarPrateek Singh Sengar
Hi Kristen,
Try converting the "Media" to 'Media'
Kristen LundKristen Lund
Well that was a super easy fix! No errors now - thanks for the help!
Kristen LundKristen Lund
So I can save with no error messages, but now the list doesn't show up regardless if the field in question is 'Media' or not.