Jump to content

Recommended Posts

I have a form that has two embedded forms (iframe datapage deployment)

First subform is a submission form and the second a single record update form.

I have a javascript function that is run by clicking on a button in the parent form that randomly selects a record whose parameters are then passed to both of the embedded forms. After the action is completed, I want to submit both of the embedded forms, without submitting or reloading the parent form, because the action can potentially be repeated. I have tried several options, but can't get the submit to work.

Below is my javascript funtion as I have it now.

The names of my iframe forms are 

Form a - embeddedsubmitform

Form b - embeddedupdateform

Any help would be greatly appreciated. Thank you

<script>
    function getemprec()
    {
        var radget = document.forms[0].elements["cbParamVirtual5"]; //this is radio button that will determine the number of times the function will be run
            for (var i=0; i<radget.length;i++)
            {
                if(radget.checked)
                {
                    var S1 = radget.value;
                }
            }
            var S2 = Number(S1);
            var E1 = document.getElementsByName("cbParamVirtual4")[0].length; //this returns a list of total records in the system
            var E2 = Number(E1);
            var E3 = E2/S2;
            var S3 = Number(E3);
            document.getElementById("InsertRecordNumber_of_Screens").value = S3;
            
            var scrtyp = document.getElementById("InsertRecordScreening_type").value;
            var scrdate = document.getElementById("InsertRecordDate_of_Screens").value;
            var T1 = document.getElementsByName("InsertRecordEmployees")[0].length;
            var n1 = Number(T1);
            var n2 = n1 - 1;
            var numb = Math.floor(Math.random()*n2);
            var numb2 = Number(numb);

            document.getElementsByName("InsertRecordEmployees")[0].selectedIndex = numb2;
            var reclist = document.getElementsByName("InsertRecordEmployees")[0];              
            var recvalue = reclist.options[reclist.selectedIndex].value;
            document.getElementById("cbParamVirtual2").value = recvalue;    
            document.getElementById("embeddedsubmitform").src ='../pages/submit.html?SelEmp_Rec_ID='+recvalue+"&Screen_Type="+scrtyp;
            document.getElementById("embeddedupdateform").src ='../pages/update.html?DS_Emp_Rec_ID='+ recvalue+"&DS_date="+scrdate;
            document.getElementsByName("embeddedsubmitform").submit();        
            document.getElementsByName("embeddedupdateform").update();    


        }
</script>

Link to comment
Share on other sites

Auto-Submitting does not work when more than one DataPage is present in a web-page.

A workaround would be to change to a one-DataPage layout.

Auto-submit the first page, then upon submitting, pass the param through, load the second DataPage which also auto-submits, then refresh the child.

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...