I want make a page read only. This is the code I've tried:

<apex:page showheader="false" sidebar="false" id="page" extensions="test"
    standardcontroller="test__c" readOnly="true">
  <apex:form >
    <apex:pageBlock id="pbCustomerDetails">
      <apex:pageBlockSection columns="1" collapsible="false">
        <apex:inputField value="{!test.Legal_Name_in_English__c}" label="Name of Customer"/>
        <apex:inputCheckbox value="{!test.Legal_Name_Checkbox__c}" label="legal name" />
        <apex:inputField value="{!test.Legal_Name_in_Local_Language__c}" rendered="{!(test.Legal_Name_Checkbox__c == true)}" /> 

The readonly="true" property of <apex:page> is not making the entire page read only, can somebody explain why?


Use <apex:outputfield> instead of <apex:inputfield> wherever you are trying to accept input.

Quoting from Documentation, this is what readonly does

A Boolean value that enables read-only mode for a Visualforce page. In read-only mode, a page may not execute any DML operations, but the limit on the number of records retrieved is relaxed from 50,000 to 1 million rows. It also increases the number of items in a collection that can be handled by iteration components, from 1,000 to 10,000. If not specified, this value defaults to false.

I am not aware of any other way of making the page not accepting inputs. In readonly mode even though you can accept inputs no DML operations are performed

  • 1
    Then whats the use of readonly property – TestNS Nov 29 '13 at 4:30
  • updated the answer – Prady Nov 29 '13 at 4:46

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.