Skip to content

Instantly share code, notes, and snippets.

@acoyfellow
Last active January 4, 2024 19:14
Show Gist options
  • Save acoyfellow/0ecf77ce624888de9964d0aa0c74949f to your computer and use it in GitHub Desktop.
Save acoyfellow/0ecf77ce624888de9964d0aa0c74949f to your computer and use it in GitHub Desktop.
Prevent duplicate form submissions in Phonesites.com
<script>
// Add to Custom Code > Bottom of Body
try{
if(localStorage.getItem("lead_id")){
setError("Only one submission allowed.");
throw new Error();
};
} catch(e){
console.error(e);
};
window.beforePost= function(){
try{
if(localStorage.getItem("lead_id") || store.submitCount > 1){
store.preventPost= true;
window.location.reload();
};
}catch(e){
console.error(e);
};
};
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment