+ Start a Discussion

How do I allow/disallow input to a field on a visual force page?

I am trying to control when a user is allowed to enter something into an input field on a visual force page. Something like this:

{!IF(some-condition,<apex:inputField value="{!budget.Jan_Season__c}" />,<apex:outputField value="{!budget.Jan_Season__c}" />)}

When I try to use this, it complains about EL Expression Unbalanced.

Any suggestions would be greatly appreciated.
Don't you want something like this?

<apex:inputField value="{!budget.jan_season__c}" rendered="{!someCondition}"/>
<apex:outputField value="{!budget.jan_season__c}" rendered="{!NOT(someCondition)}"/>

Furthermore, for reference, once you start a {! ....} expression, you don't embed any further {! ..} expressions; SFDC will evaluate everything inside the {!..} as a merge field, formula operator, formula function, or constant - just as if you were coding a formula or validation rule on Force.com.