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
Pri TaunkPri Taunk 

Help with VF Page

Hi
I have created this VF page within a custom object, I'm still in the process of adding more fields within this for the users to key in info. However, when I tested this by adding it to the page layout for the custom object, when I click on save, when the VF page refreshes the view doesn't look right.
I'm quite new to VF pages so still learning. Could anyone help as to what am I doing incorrectly here, how/what can I add to the VF code so that when the users hit 'save', it reflects correctly. (attached a couple of screenshots).

User-added image
User-added image

Thanks in advance.


 
Nikhil Verma 6Nikhil Verma 6
What do you mean it does not reflects correctly. From the screenshot it seems that the VF page is not displayed at all. If that is the case, go to the page layout section where this page has been added and make sure in the settings that it has been enabled for both detail and edit pages. If that's not the case, kindly elaborate your problem.
Thanks.
Pri TaunkPri Taunk
Hi Nikhil, thanks for responding. The layout section has both the edit / detail page enabled. What i mean is when I hit save, I get this view ( attached screenshot). It looks like an additional SF isntance within the VF page. If you look at the section titles in this screenshot, the account  overview is appearing again within the VF page and also the fields still look like they are yet to be saved even though I hit save.

Here's a copy of the VF code https://gist.github.com/pritaunk/64ac7c1f1c72817c80fa7ec50dc36b19 


User-added image
RbnRbn
Hi Pri,

You have to add the below line of code after  <apex:pageBlockSection >
 
<apex:inlineEditSupport showOnEdit="save_id"   disabled="false" event="ondblclick" />
showonedit ="save_id" - This is the id which we declare for the  <apex:commandButton action="{!save}" id="save_id"/>

Let me know if it solved your problem.

Regrds,
Rabi
Pri TaunkPri Taunk
Thanks Rabi, I just tried and it's doing the same thing. Someone suggested it's coz there are multiple forms but i don't see multiple forms. I amended the code a bit to include some read only fields into the VF page ( https://gist.github.com/pritaunk/b9e20a86dbeb365a36a1048bf4ab7817 ) and added your line of code on line 44 after </apex:pageBlockSection> and it still does the same thing.. reloads as a new instance within the vf page... 
RbnRbn
Hi Pri,

Let me know if it is fine for you to go over a GTM, so that it would be easy for to understand where the problem is.

If so, let me know i will ping the GTM details

 
Pri TaunkPri Taunk
Hi Rabi, thanks for your help, I actually managed to make it work with your code, in, it worked when I changed it to apex:commandlink instead of apex:commandbutton!