+ Start a Discussion

new() in visualforce page..

Hi i have developed a visualforce page ...and i have defined acommandbutton (New).UP on command button i invoked an action called newrecord().

and code for newrecord() is as follows .


public PageReference newRecord()
PageReference pr = System.Page.caftest6; // or 'new PageReference('url');//

return pr;

and  my command button is as follows. 

<apex:commandButton disabled="{!isNewButtonDisabled}" value="New" action="{!newRecord}" />


Now when ever i click new button its redirected back to d same page...so as u know redirection will take moretime instead of redirection i want to be in d same page but want to define a new mode for d page.so dat wen i click new button standard new button functionality is achieved ..So what i expect is without redirecting to d same page again i want to be in d same pagein new mode.. I have tried it by clearing d fields but den d page is not in new mode.....


   So someone plz help me with an saqmple example of defining new mode for new button instead of redirecting to the same page again...




Salesforce ExpertsSalesforce Experts
Please reach out to us if you are looking for online training in Salesforce. . We provide crash courses on weekends as well to speed up your learning on salesforce skills. Course fees only Rs 5000 for 20 hour session covering basics of Salesforce. If interested please feel free to contact on salesforcebuddies@gmail.com.