You need to sign in to do that
Don't have an account?
Karen Brown 39
How do i change Visualforce page not to default to edit mode
I have created a visualforce page but when you click on the page section it is defaulted to edit mode, i want it to behave similar to classis in the way that its in read mode until you click an edit button.... here is the starting code of my page
<apex:page standardController="opportunity" lightningStylesheets="true">
<apex:messages />
<apex:form >
<apex:pageBlock title="" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:page standardController="opportunity" lightningStylesheets="true">
<apex:messages />
<apex:form >
<apex:pageBlock title="" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
It will be easier to analyse if you can just paste your full code here and explain which part of the page you want to make readonly.Thanks!!
<apex:page standardController="opportunity" lightningStylesheets="true">
<apex:messages />
<apex:form >
<apex:pageBlock title="" mode="edit">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:pageBlockSection title="Credit Committee" columns="2">
<apex:inputField value="{!opportunity.No_of_days_waiting__c}" required="false"/>
<apex:inputField value="{!opportunity.Credit_minute_approved_internally__c}" required="false"/>
<apex:inputField value="{!opportunity.Credit_application_started__c}" required="false"/>
<apex:inputField value="{!opportunity.Credit_minute_signed__c}" required="false"/>
<apex:inputField value="{!opportunity.Credit_application_approved_by_Head_of_C__c}" required="false"/>
<apex:pageBlockSectionItem />
<apex:inputField value="{!opportunity.Credit_app_approved_internal__c}" required="false"/>
<apex:inputField value="{!opportunity.Credit_app_re_approval__c}" required="false"/>
<apex:inputField value="{!opportunity.Credit_application_approved_by_TSSP__c}" required="false"/>
<apex:inputField value="{!opportunity.Credit_app_re_approval_comments__c}" required="false"/>
<apex:pageBlockSectionItem />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
You need to change the input field to output field in order to make it read-only.
Follow the below step to view the above page in read-only on Opportunity .
Step 1- Go to set up find the opportunity Object
Step 2- Find "Buttons, Links, and Actions" on Opportunity
Step 3- Override the view Force from the View button.
Step 4- Go to opportunity Detail page and see the vf as the result.
<!----------------Another way------------------>
Here you need to pass the id in the url and also override the view of opportunity.
--
Thanks,
Prashant
so when they click on the tab it looks like this....i want it to be in read mode with an edit button we cant assume the6y want to edit just because they navigate to the tab.
Did you override the detail page with your visual force page..if yes then you will always see the detail page in Edit mode.
--
Thanks,
Prashant
--
Thanks,
Prashant
Error: Unsupported attribute required in <apex:outputField> in test at line 15 column 98
Just remove the required "attribute" from all the outputfiled.. and try.
--
Thanks,
Prashant
Any ideas how it can just present the relevsnt fields?
or Create a visualforce page as earlier you have created earlier and as soon as the user clicks edit you need to redirect to new vf.
--
Thanks,
Prashant
Thanks
--
Thanks,
Prashant
- Opportunity detail
- Key Dates
- Credit Application
- Professionals
- Final Closing Checklist
When we moved to lightning because it makes the page scroll even longer due to the fields entry being below the field label and not to the side we decided to reduce thr layout we would create a visualforce per section and have these displayed as tabs in lightning to reduce scrolling, so with your solution for editing the page byu adding the button etc it redirects to edit the full page and not just the section specific to the visualforce page.Does that make sense?
Let me know if have any issue..
--
Thanks,
Prashant
Opportunity detail
Key Dates
Credit Application
Professionals
Final Closing Checklist
--
Thanks,
Prashant