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
kdanikdani 

visualforce help

Hope someone can help me out

 

I have created a table to hold information, one column which needs to be edited. however on clicking the save button the section where I have placed the visualforce page loads the whole salesforce page, any help appreciated, this is my code.

<apex:page standardController="Account" tabstyle="account" sidebar="false"> <apex:form > <apex:pageBlock > <apex:pageMessages /> <apex:pageBlockButtons > <apex:commandButton value="Save" action="{!save}"/> </apex:pageBlockButtons> <apex:pageBlockTable value="{!account}" var="account"> <apex:column value="{!Account.Projected_Revenue_FY_11_12__c}"/> <apex:column headerValue="Account Owner Projected Revenue"> <apex:inputField value="{!Account.Account_Owner_Projected_Revenue__c}"/> </apex:column> <apex:column value="{!Account.Projected_Revenue_Variance__c}"/> </apex:pageBlockTable> </apex:pageBlock> </apex:form> </apex:page>

 The VF page displays exactly how I would like until I click on Save and then the issues arise. If someone knows how I can get the table to be closed and then have Edit button to open it up to be edited and a save button that returns the page how I need it to, would be eternally grateful.

 

I'm not to good with custom controllers so hoping this can be done without them.

 

Thanks

KD

 

 

 

bob_buzzardbob_buzzard

This is because the save button invokes the save method from the standard controller.  The page reference returned by that method is a redirect to the standard object view page.

 

I don't think you'll be able to achieve this without a custom or extension controller.  It sounds like you want one area of the page (the table, save button etc) to be rendered when in edit mode, while another area containing just an edit button is rendered when in view mode.  In order to manage the mode, you will need to have custom actions for the edit and save buttons that change it accordingly.  

 

It doesn't sound like a hugely complicated requirement.  Do you have particular problems with custom controllers, or is it the whole Apex thing? 

kdanikdani

The whole apex thing really, its quite an achievement I've got this far, I did all this from with the org, I'm a bit lost with the IDE thing. Can I create custom controllers/extensions from within the salesforce org?

 

My requirement is exactly as you describe it. Thanks for your reply

 

KD

bob_buzzardbob_buzzard
You can create code in a dev org or sandbox without recourse to the IDE - Setup -> App Setup -> Develop -> Apex Classes.
kdanikdani
great, can I then push this across into my live org from there or would i jut require the IDE to do that.
kdanikdani

do i need something like the below. would I then refernce this controller in the VF page code?

 

 

public class speedy_projectedrevenueController { public boolean editMode {get; set;} {editMode = false;} // Switch to Edit mode public PageReference doEdit() { editMode = true; return null; } // User has pressed Cancel Edit button public PageReference doCancel() { editMode = false; aiRows = null; return null; } // User has pressed Save button public PageReference doSave() {

 

 

 

bob_buzzardbob_buzzard

If you have change sets enabled, you can deploy from sandbox to production using those.

 

Your code looks like you are heading in the right direction.  Good luck!