Got it to work hope this helps someone.
AUTOSUBMIT
MULTIPLE PAGES (Submission forms ) TO 2 TABLES in a Parent-Child Relationship
Tables are in a Parent-Child Relationship
Submission Form- Destination setting - URL of Autosubmit form
AutoSubmit Form - Destination setting - Display a Message
Tips
In the First Submission Form
You dont need to create a virtualID element to pass the Primary Autonumber key.
It gets sent by default.
In the Auto Submit Form (2nd data page)
Make sure the Foreign Autonumber Key and any Unique Keys are not hidden or in display mode, they should be as regular Fields. Dont hide them or they wont work.
Make sure all of the above fields receive parameters or the form wont submit due to incomplete required fields
The other fields you can leave hidden.
In the Autosubmit form , the fields and submit button can be hidden with nodisplay tags in an HTML Block and also by using a Different Localization
Passing parameters in 1st Submission form
The Most Important thing while passing/receiving parameters use INSERTRECORDfieldname;
Even in javascript for getElementById use INSERTRECORDfieldname
Otherwise nothing works.
Script That Finally worked and just submits once (doesnt loop)
-----------------------------------------
<script type="text/javascript">
var tacyidvalue;
tacyidvalue=document.getElementById('InsertRecordTacyID').value;
if(tacyidvalue !=='')
{
document.getElementById("caspioform").style.display = 'none';
setTimeout('document.forms["caspioform"].submit()',1000);
}
</script>