When a user is filling in a form, inadvertently clicking on a link to another page, or generating the page back, the keyboard shortcut sends the browser to a new page and discards all user inputs. In the event that the form is large and complex, this can represent a significant lost effort.
In this recipe we will create a Visualforce page that allows a user to create a contact record. If the user clicks on a button to save the record or cancel the creation, they will be requested to confirm that they wish to continue with the action. If the user clicks on the Save or Cancel button, this will submit the form without further confirmation.
This recipe uses the jQuery (http://jquery.com/) JavaScript framework to swap the buttons. The JavaScript file is included from the Google Hosted Libraries content delivery network rather than being uploaded as a Salesforce static resource, as this makes it straightforward to move to new versions simply by changing the...