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

Visual Force page, how do I check for a value in the output link

How would I check if the URL is populated in the below code?
What I would like to do is display 'Open URL' if a URL exists.
If no URL, then I would like to display 'No URL Available' or leave it blank.

 <apex:pageBlockSectionItem >
      <apex:outputLabel value="MY URL" />
     <apex:outputLink value="{!defaultURL.MY_URL__c}" target="_blank">Open URL</apex:outputLink>
KC ShaferKC Shafer
If you are using a controller or extension, you can define the url label in you apex, depending on the value of the url. So basically have a property for urlLabel, then check if the url is null or not to fill in the urlLabel. Alternatively, you can do something like this render different text with the rendered attribute.
<apex:outputText value="{!test}" rendered="{!test != null}"/>
    <apex:outputText value="No value" rendered="{!test == null}"/>