You need to sign in to do that
Don't have an account?
SFDC NB
Confirm before saving
Hello,
I'm new to Apex, I'd like to know how can we have a user confirm Yes/No and save the record based on user input.
e.g.
User creates new contact and clicks save, if there is another contact with the same email address we'd want a confirmation box to pop up and say that this is a duplicate if they'd still like to continue.
If the user clicks yes, the contact is created/saved. If the user clicks no the record is not save.
I'm new to Apex, I'd like to know how can we have a user confirm Yes/No and save the record based on user input.
e.g.
User creates new contact and clicks save, if there is another contact with the same email address we'd want a confirmation box to pop up and say that this is a duplicate if they'd still like to continue.
If the user clicks yes, the contact is created/saved. If the user clicks no the record is not save.
status="LoadingStatus" onclick="return confirm('Are you sure?');"/>
<script>
function confirmRemoveAll() {
if(confirm('Are you sure?')) {
removeAll();
return false;
}
return false;
}
</script>
<apex:commandButton value="Remove All" onclick="return confirmRemoveAll();"/>
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery('.saveAction').click(function(e) {
if ( confirm('Are you sure you want to save? Click OK to continue saving.') ) {
return true;
}
e.preventDefault();
});
});
</script>
<!-- somewhere on your page is your button -->
<apex:commandButton action="{!save}" value="Save" styleClass="saveAction"/>
if(accstatus.value=='Locked'){
var userchoice =confirm('Are you sure you want to lock the Account?');
if(userchoice){sfdcPage.save(); return userchoice;}
else{sfdcPage.revert(); return userchoice;}
}
else{sfdcPage.save(); return userchoice;}
};
You need to create custom VF page and Controller to save Conact records. then override your VF page on standard page.
For more visit https://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_tabs.htm