JavaScript: Calling actions of an object on the parent page from modal window

andrew-robertson
andrew-robertson Community Member Posts: 277 ☆ Superstar ☆
I have a page built in Lectora v21 and it opens a modal window (also built in Lectora) in the middle of a page when a button is clicked, when I close that window I would like to do something with the objects on the parent's page such as disable a specific button. I remember in Flash there was a fairly easy way to do this, but since I am new to JS/JQuery I am a bit lost.

Ideally I'd like to be able to make a call similar to....

obj1234.actionHide();
obj1234.actionShow();
etc....

I remember being able to do this relatively easily in Adobe Animate, but as in my previous posts - I am still fairly green between the ears with JavaScript and the such.
Andrew R.
Developing content since 2010 using a mixed bag of tools.

Answers

  • CarlJFink
    CarlJFink Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 67 ☆ Superstar ☆
    Not to short-circuit your question, but if the window is modal and you always want the button disabled when the modal window closes ... why not just have your "open the modal window" button disable that other button immediately, before opening the new window? Same effect, no JS required.
  • andrew-robertson
    andrew-robertson Community Member Posts: 277 ☆ Superstar ☆
    Great idea, but there is more complex reasoning behind my over simplified question.
    Andrew R.
    Developing content since 2010 using a mixed bag of tools.
  • timk
    timk Community Member Posts: 1,222 ♦ Idol ♦
    From a technical perspective: What is that modal window? A new browser window?
  • andrew-robertson
    andrew-robertson Community Member Posts: 277 ☆ Superstar ☆
    From a technical perspective, it is a modal window. In Lectora I have created a new page and then I open it as a modal.

    However, I have dug a bit deeper and forgot to post before heading on vacation that I tried the below and it worked OK...

    parent.functionName();

    parent.runGroup_og1234();
    Andrew R.
    Developing content since 2010 using a mixed bag of tools.
  • CarlJFink
    CarlJFink Community Member, Lectora® Accessibility Group (LAUG) Member, eLearning Brothers® Partner Posts: 67 ☆ Superstar ☆
    timk said:

    From a technical perspective: What is that modal window? A new browser window?

    A "modal" window is one that blocks the original window, so you can't interact with it until you close the new window. For instance, if you click a "close" button without saving first, many programs cause a confirmation window to appear, and you can't click on or interact with the original window until you either click "Save" or "Close without saving".