You need to sign in to do that
Don't have an account?
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
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?
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
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() {
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!