Post a Form to Popup window not to the parent

前端 未结 1 532
别跟我提以往
别跟我提以往 2021-01-17 00:55

I want to post a forma poupup window. Problem is, the form posts successfully but It also posts on the parent window. I want to submit the formonly in popup window

相关标签:
1条回答
  • 2021-01-17 01:32

    You could assign an onsubmit event handler to the form to call a function which pops open a new window when the form is submitted and targets the form to that window, like:

    <form action="..." method="post" onsubmit="some_popup_post(this);">
    <!-- form fields etc here -->
    </form>
    

    And js code would be:

    function some_popup_post(form) {
        window.open('', 'formpopup', 'width=400,height=400,resizeable,scrollbars');
        form.target = 'formpopup';
    }
    

    Do you mean something like this..

    0 讨论(0)
提交回复
热议问题