This topic was mentioned in other threads but they were either incomplete or incrorrect.
Here is the right way to add a random number to a hidden field after form is submitted.
Add the following script to
<script type="text/javascript">
document.addEventListener(“DOMContentLoaded”, function(event) {
var randomNum = ‘’;
randomNum += Math.round(Math.random() * (100000 - 10000) + 10000);
var elem = document.getElementById(“external_id”).value = randomNum;
var domain = window.location.host + window.location.pathname;
document.getElementById(“external_id”).value = randomNum;
});
</script>
Add a hidden field in your form and give it an id name
In the javascript replace the 2 instances that say “external_id” to your hidden field name
The script will generate a number between 10,000 - 100,000