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
imAkashGargimAkashGarg 

make field visible on edit page but not on detail page

how to make field(text) visible on edit page but not  on detail page?

it is the standard detail page

Best Answer chosen by Admin (Salesforce Developers) 
Sonam_SFDCSonam_SFDC

No, unfortunately its not possible with the Standard page and you cannot add javascript on a standard page so you will have to explore the VF option if you wish to implement this.

 

 

All Answers

Sonam_SFDCSonam_SFDC

Hi Akash,

 

A pagelayout (if you see the out of box functionality) is the same for both EDIT and DETAIL.

 

However, you can use Visualforce and override the edit page or Detail page such that you only show selected fields.

 

1)Create a vf page for EDIT

 

2)To override the Statndard EDIT page with your VF EDIT page > go to Setup > Customize > Contacts(for e.g.) > Buttons, Links, and Actions > setup your page as the EDIT page.

 

Hope this helps! 

imAkashGargimAkashGarg

Thanks for the suggestion.

That' a possible alternative, but cant create a vf for that.

need to use the standard page only as it has many other processes involved.

 

So, i guess it's not possible with the standard detail page, right?

just to check, is there any chance of getting it done by javascripts or something else?

Sonam_SFDCSonam_SFDC

No, unfortunately its not possible with the Standard page and you cannot add javascript on a standard page so you will have to explore the VF option if you wish to implement this.

 

 

This was selected as the best answer
imAkashGargimAkashGarg

Thanks.

Peter_sfdcPeter_sfdc

Bear in mind that going to Visualforce is not an all-or-nothing decision. You can keep your page layout as your standard page, but then us VF as edit. Or vice-versa. When you override an action, using the URLFOR() function, you can have an action either use the override, or ignore the override. You have a good deal of flexibility so be sure to weigh your options and get to know what you can do. 

imAkashGargimAkashGarg
Great! that's a possible work-around for my requirement :)
Peter_sfdcPeter_sfdc

One more thought. You can even use your page layout inside a visualforce page. The apex:detail component in VF allows you to stick your page layout into your VF page. 

 

You could also embed a VF page into your page layout. So only the parts of the UI that need to have formula or JS logic need go in that part. 

imAkashGargimAkashGarg
Yeah that's true.
but on adding a detail page in the vf, we cant make changes to the fields in the detail page. :(
sunny522sunny522
Hai All,
We can use javascript in homepagecomponent for this requirement.Try in this way.It works
imAkashGargimAkashGarg
Can you plz share some sample js code for this?
sunny522sunny522
Hai Akash,try this
<script language="JavaScript1.2" src="/js/functions.js"></script> <script src="/soap/ajax/9.0/connection.js" type="text/javascript"></script><script>Sfdc.onReady(function() {alert("hai");document.getElementById('00N900000070pbQ_ileinner').style.display='none'; });</script>
replace id with ur required field id.similarly u can remove label of that field.
imAkashGargimAkashGarg
That's interesting.
I was able to hide the field value from the page, how can i hide the field label too?
As 00N900000070pbQ_ileinner' removed the field value and 00N900000070pbQ_ilecell' removed the cell.

how to hide the field label also?

Many Thanks
Peter_sfdcPeter_sfdc
If you are doing that hacking the CSS, you are setting yourself and
those who follow you up for head aches. These id's are unique to the
org you are working in. Once deployed to another org this will break.
This not a supported approach.

This is a far worse approach than Visualforce which is at least
deployable and will be guaranteed to work on all future versions.

Really don't see why you don't opt for VF inline to a page layout.

Peter Chittum
Salesforce.com UK
@pchittum
sunny522sunny522
Ok.Thanks for ur reply.I may try for other approaches