Skip Navigation

[Resuelto] Bootstrap Modal not staying open

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem: When I open a Bootstrap modal, it appears and immediately disappears without any user interaction.

Solution: In this case, the Bootstrap Modal plugin seems to be the source of the problem. Since Toolset is already loading Bootstrap, the plugin is not necessary. Please disable it.

This support ticket is created hace 7 años, 3 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

Este tema contiene 10 respuestas, tiene 2 mensajes.

Última actualización por Charles hace 7 años, 3 meses.

Asistido por: Christian Cox.

Autor
Mensajes
#558274

Support,

I am trying to implement a modal into my content template. Upon inserting the code and clicking the modal button, the modal quickly shows then disappears. I'm not sure what the conflict is.

Page with modal (at bottom of page): enlace oculto
Modal code used: enlace oculto

Thanks,
Chuck

#558275

I have also tried this plugin, which is essentially the same code just in plugin format with controllable CSS: https://wordpress.org/plugins/bootstrap-modals/

If we could get the plugin working that would be better as changing CSS would be easier.

#558300

Hi, you shouldn't need any additional Bootstrap Modal plugin because Toolset loads Bootstrap automatically based on your settings in Toolset > Settings > General. Bootstrap Modals work without any additional plugins, you just have to add the markup. Please deactivate the bootstrap modals plugin, and try again.

#558329

Chrisitian,

The plugin is not active. On this page (enlace oculto) I am using this code:

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h4 class="modal-title">Modal Header</h4>
      </div>
      <div class="modal-body">
        <p>Some text in the modal.</p>
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>

  </div>
</div>

The modal only opens for a split second then closes.

Thanks,
Chuck

#558331
modal.png

Take a look at the source of this page. I'm attaching a screenshot. For some reason, the bootstrap modal plugin's assets are still loading on the page. Any idea why that would be happening?

#558404

Christian,

I got this to work properly. Not sure what was going on.

On this page there's a prompt with a button to "contact seller": enlace oculto

The prompts code is as follows:

[x_raw_content ][prompt type="left" title="Asking Price" message=[types field='price'][/types] button_text="Contact Seller" href="<em><u>enlace oculto</u></em>"]

This is the modal code I am trying to insert into the prompt:

<!-- Trigger the modal with a button -->
<button type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Contact Seller</button>

<!-- Modal -->
<div id="myModal" class="modal fade" role="dialog">
  <div class="modal-dialog">

    <!-- Modal content-->
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">×</button>
        <h4 class="modal-title">Contact Seller</h4>
      </div>
      <div class="modal-body">
         [cred_form form='contact-seller-form']
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
      </div>
    </div>
  </div>
</div>

The element breaks down when I take out:

button_text="Contact Seller" href="<em><u>enlace oculto</u></em>"

and insert the modal code.

Are you able to identify what I'm doing wrong? The modal and cred form works great when it's standing alone. I was actually surprised to see the messages go through first try.

Thanks,
Chuck

#558623

I'm not familiar with the prompt shortcode, but it's possible you can't use anything but plain text. I think it's a Cornerstone element, so your best bet is to ask their support team if the prompt shortcode will accept HTML text that contains other shortcodes, or if you must recreate this element somehow without using the prompt shortcode.

#558631

Got it. I'll reach out to them.

Thanks,
Chuck

#558686

Got it working!

enlace oculto

How can I add conditions?
If user logged in modal pops up and shows the CRED form.
If user not logged in they're diverted to login page then back to post

Thanks,
Chuck

#558705

I would use conditional HTML and two prompt shortcodes. One prompt includes the modal trigger and the other contains a link to the login form. The conditional HTML will test whether or not a user is logged in by accessing the User ID. If the User ID is set, your user is logged in. If not, they are not logged in.
User information shortcode reference:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-user
Conditional HTML reference:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/

If you need more details, please open a new ticket so we can address this as a separate issue. Thanks!

#559121

This worked.

Good look,

Chuck