What event is triggered when input values are populated from browser cache (when user clicks the back button)

Background

I am working on an e-commerce website, where users can create a product (list a new product)

When user wants to create a new product, they open a new form, fill the product details and click on submit.

After submitting the form, they can click the back button… all the values that they had previously filled, gets automatically filled from browser cache…

Now if the user submit this form, the e-commerce website creates a new product (instead of editing the existing one) because the form values populated from browser cache don’t have an id (id is generated on the server side, after submitting the form)

I want to prevent this by clearing the form, if the user comes to the form by clicking the back button.

Here is what I have tried:

function clearFormIfAlreadySubmitted() {
    let isNewProduct = $('#productId').val() == 0;
    if (isNewProduct) {
        let submitStatus = $('#submitStatusId').val();
        if (submitStatus === "submitted") {
            // if product does not have an id and the form has already been submitted 
            // reset the form
            $("form").trigger('reset');
        }
    }
}

// set the submitStatusId (hidden input)
function setFormSubmitStatus() {
    if ($("form").valid()) {
        $('#submitStatusId').val("submitted");
    }
}

$(document).ready(function () {
    $("form").on('submit', setFormSubmitStatus);
    clearFormIfAlreadySubmitted();
});

so I have added a hidden input submitStatusId and set its value when submitting the form.

If product does not have any id and submitStatusId == 'submitted' I want to reset the form.

The problem

The problem is the value of my input submitStatusId is not available at the time document.ready event is triggered… it seems like the input value gets set from the browser cache after document ready… I am not sure which event handler I should use to check the value of my input after it’s set?

If I change my code to the following then it works as expected:

$(document).ready(function () {
    $("form").on('submit', setFormSubmitStatus);
    setTimeout(() => {
        clearFormIfAlreadySubmitted();
    }, 100);
});

But I am wondering if there is an event that I can listed to instead of randomly waiting for 100 ms?