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
Calvin BarrCalvin Barr 

visualforce word export: add text based on checkbox status

Hi - I want to be able to add a custom block of text based on the status of a checkbox for a document. 

I added the following pageblock information in the place in the contract where the I want the text to conditionally appear, but I keep getting an error on the input field. Do I need to add something to controller or header?

Much appreciated 

<apex:page standardController="Contract"
-
-
-
<apex:pageBlock id="theBlock">
   <apex:inputCheckbox value="{!My_Checkox__c}">
      <apex:actionSupport event="onchange" rerender="theBlock"/>
   </apex:inputCheckbox>
      <apex:inputText value="THE TEXT I WANT TO DISPLAY" rendered="{!(My_Checkox__c == true)}"/>
</apex:pageBlock>
-
-
-
</apex:page>

 
Best Answer chosen by Calvin Barr
Pradeep SinghPradeep Singh
InputText  supports formula expressions (values like {!something.textvariable}.
If you just wamt to show the text use outputText instead.

If you need inputText only then you have to use some variable for that.

All Answers

Pradeep SinghPradeep Singh
Hi, you have to specift the object for which you are using the field. If you are using it for Contract, then replace value="{!My_Checkox__c}" by value="{!Contract.My_Checkox__c}"

If this solves your issue, please mark it as best answer.
Calvin BarrCalvin Barr

Thanks Pradeep, but I'm still getting error:  <apex:inputText> must contain only a formula expression that resolves to a single controller variable or method. 

Any thoughts?

Pradeep SinghPradeep Singh
InputText  supports formula expressions (values like {!something.textvariable}.
If you just wamt to show the text use outputText instead.

If you need inputText only then you have to use some variable for that.
This was selected as the best answer
Calvin BarrCalvin Barr
That worked, thank you!