bootstrap-modal icon indicating copy to clipboard operation
bootstrap-modal copied to clipboard

Form element is lost on modal.load() in chrome

Open carlwitt opened this issue 11 years ago • 4 comments

I'm loading a form via ajax. The server generates this plaintext response, which is captured by modal.load()

<div class="modal-header">
    [...]
</div>
<div class="modal-body">

    <form action="{{ submitURL }}" method="post" {{ form_enctype(form) }}>
        form contents...
    </form>

</div>
<div class="modal-footer">
    [...]
</div>

The strange thing is now that, when this content is embedded into the modal, the form tag gets lost. I double checked the server response (by inspecting the server response and printing the result using the console like below).

// fill the modal with modal skeleton markup (header, body, footer) and form inputs
$modal.load(modalRetrieveUrl, '', function(data){
    console.log(data);
    $modal.modal();
});

But when I inspect the modal code in chrome, the form tag disappeared. In firefox, it works fine. I could workaround the issue in chrome by adding another, empty form tag, which gets lost instead of my real form. But this also generates an additional form tag in firefox.

Very strange behavior.

carlwitt avatar Mar 14 '13 13:03 carlwitt

Quick fix : add a empty script tag before the form tag.

thomandre avatar Apr 16 '13 15:04 thomandre

I'm getting this error too - in Chrome and Safari. Neither of the suggested fixes in this thread have worked for me either.

tddrmllr avatar Jun 21 '13 08:06 tddrmllr

+1 , save my life

igormancos avatar Jan 23 '15 07:01 igormancos

I solved this by making sure that all input elements are self-closed.

uschmann avatar Nov 27 '15 10:11 uschmann