+ Start a Discussion
Vipul Sharma 15Vipul Sharma 15 

Post the HTML form using an iframe and lightning component controller without Submit button

Hi
I am kinda stuck.
I have a div, form and an iFrame inside a lightning component. Div has the onClick attribute and moment div is clicked , it should POST the HTML form and iFrame should be visible with hosted page.

parametersValues and signedData, these details are present already.
Component Code

<div aura:id="sectionOne"  onclick="{!c.sectionOne}">
                                <div class="slds-hide slds-p-around–medium" aura:id="articleOne">
                                 <body> 
                                    <form id="theFormHost"  action="https://testsecure.com/pay" 
                                          target="my_frame" method="post" >
                                        <aura:unescapedHtml value="{!v.parametersValues}" />
                                        <aura:unescapedHtml value="{!v.signedData}" />
                                       </form>
                                </body>
                                <iframe aura:id="my_frame"
                                        name="my_frame" 
                                        src ="https://testsecure.com/pay"
                                        width="100%"
                                        height="250"
                                        frameborder="0">
                                </iframe>
                                </div>
                                </div>
------------------------------------------------------------
JS controller code
sectionOne : function(cmp, event, helper) {
var lst= cmp.find('articleOne');
        for(var v in acc) {
            $A.util.toggleClass(lst[v], 'slds-show');
            $A.util.toggleClass(lst[v], 'slds-hide');
        }
 document.getElementById('theFormHost').submit;
}

Any help is appreciated.