• I would like to open a Modal Dialog with a javascript call.
    This is because I would like the dialog to open upon an event or condition that is created in javascript.
    In fact, this seems to be the basic idea of a ‘popup’. Not when a user intentionally clicks on a link or button. I seldom need that.
    Right now, I hide the link that causes a popup. And then I use javascript to ‘click’ the link. That causes the Dialog to open. This is very awkward.
    Would you please tell me a better way?
    Thanks,
    Tim

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Wow-Company

    (@wpcalc)

    Hello.

    Sorry, but in the current version of the plugin, it is not possible to open a modal window through javascript.

    In your script, you can simulate a click on a button to open a modal window. for example:

    jQuery(document).ready(function ($) {
    	
    		$('.wow-modal-id-1').click();
    	
    	});
    
    Thread Starter timblancke

    (@timblancke)

    Hi, and thanks for the fast response!
    I get the Concept, but not the Implementation.
    I assume that a Dialog [Wow-Modal-Windows id=1] already exists.
    What is its Trigger setting?
    Mainly, I can’t understand the button part. Please elaborate a bit.

    Assuming the Dialog is a class object: Another approach is to tell me: 1) the Class Constructor, and 2) the Class Function that opens the dialog.
    Thanks,
    Tim

    Plugin Author Wow-Company

    (@wpcalc)

    The modal window works via the jQuery plugin.
    What do you mean about ‘Trigger setting’?

    At the moment there is no possibility to call a separate function for the modal window from the plugin.

    Thread Starter timblancke

    (@timblancke)

    Hi,
    If you look at your plugin settings you will see ‘Popup Settings’. To the right you will see the ‘Triggers’ dropdown. I used ‘Click’.

    To repeat: I do not understand: “$(‘.wow-modal-id-1’).click();”.
    Saying that the Plugin uses javascript … is obvious, and not really helpful.
    What object is getting clicked on here?
    It seems to me that you are saying that the Modal is the target of clicks since that’s what I think “$(‘.wow-modal-id-1’)” is.

    It would most helpful if you could add just 1 line of code, with a button, so that I could see how it all works.
    Thanks,
    Tim

    Tim

    Plugin Author Wow-Company

    (@wpcalc)

    Sorry, but I do not understand your ultimate goal.
    Can you describe in more detail what you want to do?

    Thread Starter timblancke

    (@timblancke)

    My goal is to be able to call up the Modal display of a Dialog using Javascript.

    An example would be when Javascript determines that a required Form Input has not been filled out, or that a certain score on a test was not achieved. In other words I want to popup a Dialog at certain times that may not be expected by the user. I would have thought that you would have thought this to be a common usage. Think of the word ‘Popup’.

    I have already implemented this by using the ‘Click’ Trigger option, and then hiding the link, and then using a Javascript .click() call to the hidden link and show the Dialog.
    This approach works. But it is awkward, and the creation of the hidden link seems unnecessary. It hurts to do that.

    I have also tried another plugin, ‘Popup Builder’. Those folks gave me their Dialog’s Class Constructor, and the class .show() function. Thus I create a Dialog Object with jQuery(document).ready(function ($) {
    and use the Object’s .show() function to call the Dialog. No hidden intermediate object is required.

    I hope this explains my Goal. You could help by showing me how to open one of your Dialogs using a button’s ‘onClick() function.
    Tim

    Thread Starter timblancke

    (@timblancke)

    PS:
    You can see all this at my plugins model site: https://blancke.org/Spacious_Free/wp-admin/
    Log in as:
    User: wow
    PW: modaldialog

    Then use the ‘Megamenu’ menu tab and click on ‘Dialog … Modal’.
    This has Admin privileges.

    Plugin Author Wow-Company

    (@wpcalc)

    Hello.
    Ok. I understood the problem. I will implement this in the next version of the plugin.

    Thread Starter timblancke

    (@timblancke)

    Good.
    I think it will add a lot to your plugin.

    You could add a ‘Javascript call’ item to the ‘Triggers’ dropdown, and show the JS call for the Dialog in the ‘Notice’ section.

    Hope you upgrade soon.
    Tim

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Call by javascript’ is closed to new replies.