0

I have the following VF component,

<apex:component layout="none" selfClosing="true">
<apex:attribute name="label" description="This is pretty name for this input" type="String" required="true"/>
<apex:attribute name="location" type="String" description="Field Name" required="true" />
<apex:attribute name="inputObject" description="Object Name" type="sObject" required="true" />
<apex:attribute name="inputFieldName" description="Field Name" type="String" required="true" />

<apex:outputPanel rendered="{!location == "left"}">
<div class="form-group col-md-6">
  <label class="col-md-2 control-label">{!label}</label>
  <div class="col-md-6 form-control-wrapper">
    <apex:inputField styleClass="form-control" value="{!inputObject[inputFieldName]}"/>
    <span class="material-input"></span>
  </div>
</div>
</apex:outputPanel>
</apex:component>

What I want to know is if !location is left, right or middle. Depending on the incoming string I want to display a different panel (currently not built). I have also tried rendered="{!IF(!location == "left", true, false)}" but that did not work. The problem is that I get this error message,

The element type "apex:outputPanel" must be terminated by the matching end-tag ""

How can I control the rendered IF String1 == String2?

  • Did you try using single quote for "left"? – user9959 Jan 31 '15 at 19:28
2

The correct syntax is as below

rendered="{!IF(location == 'left', true, false)}"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.