0
It is possible to trigger a Submit via iframe?
I’m opening the page php form. via iframe with modal. It looks like this:
- The green button is the Submit that comes from the form page.php.
- The blue and gray button comes along with the modal (code below).
This example the form is small, but when the form is large, the green button is lost, and the way the modal presents is very intuitive.
Modal code:
<div id="modal-form" class="modal" tabindex="-1">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-body">
<div class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item iframe" src="formulario.php" allowfullscreen></iframe>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-sm" data-dismiss="modal"><i class="ace-icon fa fa-times"></i>Cancelar</button>
<button id="salvar" type="submit" class="btn btn-sm btn-primary"><i class="ace-icon fa fa-check"></i>Salvar</button>
</div>
</div>
</div>
</div>
Puts
target="_parent"
in the<form>
.– Sam
@Sam and how do I save the button in the modal to send the Submit command inside the iframe?
– Tiago
I didn’t test it but I think that’s it:
$("iframe").contents().find("form").submit();
– Sam
@Sam, I tested it, but it didn’t work.
– Tiago
@Sam, have another suggestion?
– Tiago
I believe you can create a
trigger('my-event');
with your Jquery. Dai you can trigger your event from another context , as you are using Iframe I believe a Rigger can help.– Ricardo Lucas
@Ricardolucas I don’t know how I should ride that
trigger
, you could help me?– Tiago
@Sam worked. I had not put it as a function. As you did in the code and changed here. Register here for me to mark as completed. Thank you very much.
– Tiago
If you found the correct answer if you can post help... Someone might have the doubt table and this will help that person too :)
– Ricardo Lucas