I have a Visualforce page with picklist and associated fields with it. When the picklist value is no I want the other input field values that we have provided to be saved in the database after clicking save button. other than no any other value we give it should be removed from database.
if(ds.Yes_No__c=='No')
{
ds.Responsible_Person_TEXT__c = sw.dc.Responsible_Person_Text__c;
ds.Responsible_Person__c = sw.dc.Responsible_Person_Text__c;
ds.Target_Completion_Date__c =sw.dc.Target_Completion_Date__c;
ds.Action_Plan__c=sw.dc.Action_Plan__c;
}
else
{
ds.Responsible_Person_TEXT__c = '';
ds.Responsible_Person__c = '';
ds.Target_Completion_Date__c =null;
ds.Action_Plan__c='';
}
dsSet.add(ds);
//}
}
dslist.addall(dsSet);
try{
if(dsList.size()>0){
System.debug('ds.iddddddd>>>>'+dsList.size());
upsert dslist Dealer_External_Id__c;
}
//return null;
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'All Standards have been Saved Successfully'));
}catch(exception e){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.ERROR,'Couldn\'t Save Standards, PLease try again'));
}
This method returns:
PageReference RetPage = ApexPages.currentPage();
RetPage.setRedirect(true);
//return RetPage;
return null;
This is the button for save
<apex:commandButton value="Save Standards" onclick="showSucMsg(); return false; window.top.location.reload();" styleclass="cust-btn"/>
<apex:actionFunction action="{!saveSS}" name="saveSS"/>//here it calls the above methods of class
Its updating the value only after page refresh, but I want it to be retrieved from db once after the button is clicked
Need suggestions,