You need to sign in to do that
Don't have an account?
venkatsforce
Save&New button in popup
when i press the save&new button on that time ,the popup page is not refreshed......and how to save that record and refresh with new page.....Any Examples......
Thanks
=============
venkatSforce89
on the click on save & new button call a class method & insert the record & then set all the propety which are bind with pop up page field to null & then oncomplite of save & new button rerender the pop up page outputpanel
All Answers
on the click on save & new button call a class method & insert the record & then set all the propety which are bind with pop up page field to null & then oncomplite of save & new button rerender the pop up page outputpanel
Igot the Output..........using with popup page.......
VisualForcePage
=====================
<apex:page controller="NewAndExistingController" tabstyle="Account">
<apex:form >
<apex:pageBlock mode="edit">
<apex:pageMessages />
<apex:pageBlockSection >
<apex:inputField value="{!Account.name}"/>
<apex:inputField value="{!Account.phone}"/>
<apex:inputField value="{!Account.industry}"/>
</apex:pageBlockSection>
<apex:pageBlockButtons location="bottom">
<apex:commandButton value="Save&New" action="{!save}"/>
<apex:commandButton value="Save" action="{!nsave}"/>
</apex:pageBlockButtons>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller
=====================
public class NewAndExistingController
{
public Account account { get; private set; }
Id sid;
public NewAndExistingController() {
Id id = ApexPages.currentPage().getParameters().get('id');
account = (id == null) ? new Account() : [SELECT Name, Phone, Industry FROM Account WHERE Id = :id];
}
public PageReference save() {
try {
upsert(account);
account=null;
if(account==null)
{
account = (sid == null) ? new Account() : [SELECT Name, Phone, Industry FROM Account WHERE Id = :sid];
}
} catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
//PageReference pg = new PageReference('/');
//pg.setRedirect(true);
// After Save, navigate to the default view page:
return null;
}
public PageReference nsave() {
try {
upsert(account);
} catch(System.DMLException e) {
ApexPages.addMessages(e);
return null;
}
//PageReference npg = new PageReference('https://c.ap1.visual.force.com/apex/Tst');
// npg.setRedirect(true);
// After Save, navigate to the default view page:
return (new ApexPages.StandardController(account)).view();
}
}
Grate :)