I encountered an issue in Microsoft Power Pages where refreshing the page after submitting a form results in duplicate records being created.
Steps to Reproduce:
Create a Form in Power Pages to create a new record in the Dataverse.
Configure the post-submit action to display a success message after the record is created.
Submit the form to create a new record. The success message will be displayed as expected.
Press F5 to refresh the page.
The system will display a prompt warning that refreshing the page will re-submit the form.
Click OK to proceed with the refresh.
Expected Result:
The page should refresh without any warning.
Actual Result:
After refreshing the page and clicking OK on the prompt, the form is re-submitted, resulting in a duplicate record being created in the database.
Bug Report: Form Submission Issue on Page Refresh in Power Pages
1. Use Redirect After Form Submission
In Power Pages, configure your form's post-submit action to redirect to another page after the submission is successful.
You can do this by setting the Redirect URL in the form settings, which will take the user to a different page (such as a thank-you page) after submitting the form.
After the form is submitted, use JavaScript to reset the form, so that when the page is refreshed, the form data is not re-submitted.
$(document).ready(function () {
$('#formId').on('submit', function () {
// Your form submission logic here
// Reset the form after submission to avoid resubmission
$(this).trigger('reset');
});
});
Use JavaScript to Prevent Duplicate Submissions
$(document).ready(function () {
$('#formId').on('submit', function (e) {
e.preventDefault();
// Disable the submit button to prevent further submissions
$('#submitButtonId').prop('disabled', true);
// Your form submission logic here
// Optionally, use an AJAX request to submit the form without triggering a page reload
});
});
Under review
Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.