ATTMEX Posted December 20, 2016 Report Share Posted December 20, 2016 Hi guys, I know the only way to create records in multiple table is by auto-submission, so I followed this script which works great: <script type="text/javascript"> if(document.getElementById("caspioform")) { document.getElementById("caspioform").style.display = 'none'; setTimeout('document.forms["caspioform"].submit()',1000); } </script> However when auto-submission fails (user tries to create the same record twice with a unique field) the error message says the "record already exists" and loops endlessly. Either I create some way to detect that the record already exists and therefore redirect my user to an update form or handle the error message once and move on to the update form. Any ideas on how to handle this problem? Quote Link to comment Share on other sites More sharing options...
LWSChad Posted December 22, 2016 Report Share Posted December 22, 2016 Try making the first page a user begins this process on a submission form that will alert the user when they're adding the duplicate record BEFORE any auto-submitting. I can't tell for sure, but it seems like you're passing params from one DP to the next in order to add multiple records. Then along the way, a non-unique error pops up and a loop ensues. Ensure this error prevents the user from proceeding by moving the unique record to the beginning. You can also add code to the Localization Error message. Quote Link to comment Share on other sites More sharing options...
TWIRED Posted January 11, 2017 Report Share Posted January 11, 2017 Hi ATTMEX, First Form If first table has a primary unique key (like an email address) and if in the form you set that element/field to "Required" The First Form should give the user an error message by default "Value already exists", If the user tries to submit the form with the same value. Second Hidden Form (to prevent constant submission loop) Maybe Modify your javascript with - if else if - conditions (Only if criteria is met - submit ) example in Hidden Form2 --------------------------------------------- idvalue is the passed parameter from Form1 (autonumber /unique key) -------------------------------------------------------------------------------------------------- if (idvalue =='') { alert("No ID Found !") } else if (idvalue !=='') { document.getElementById("caspioform").style.display = 'none'; setTimeout('document.forms["caspioform"].submit()',1000); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.