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
matty80matty80 

Conditionally hiding fields in View mode but showing in Edit mode

I'm trying to lock down certain fields so that they're hidden from users that aren't the record owner so I put together a brief VF page using outputField and rendered to set my condition. Then I placed that VF page in my page layout in lieu of placing the actual field onto the layout. The problem is that if the user tries to edit the record the field doesn't show itself in View mode and won't therefore the user/owner can't edit the field since it isn't on the layout.

 

Is there a alternative to hiding the field in View mode (that allows for editing), or a work around to place that field onto the Edit page. I've thought about inlineEdit on the View page but I've been having trouble implementing that, and it would still be hidden if they hit the Edit button on the record.

 

Any input would be greatly appreciated as I'm still getting familiar with VisualForce. Thank you.

Shashikant SharmaShashikant Sharma

I hope example given in this post will help you

 

http://www.forcetree.com/2009/11/inline-editing-in-visualforce.html

matty80matty80

Interesting - did you create this as an alternative to inlineEditSupport?

 

My problem here is that relying on inlineEditing would prevent users from being able to add a value to these fields when creating a new record - they could only be able to do that after the fact - as during record creation these fields would not be on the record at all.