Jump to content

Auto-submission form and Unique records Issue


Recommended Posts

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?

Link to comment
Share on other sites

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.

 

Link to comment
Share on other sites

  • 3 weeks later...

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);


}

 

 

 

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...