Answers.Body: <p>It turned out to be possible:</p>
  
  <pre><code>CRM.loadForm('/some/url')
    .on('crmFormSuccess', function (event, data) {
      // do smth
  });
  </code></pre>
  
  <p>Ref: <a href="https://docs.civicrm.org/dev/en/latest/framework/ajax/" rel="nofollow noreferrer">https://docs.civicrm.org/dev/en/latest/framework/ajax/</a></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-26T10:07:17.287Z
Answers.LastActivityDate: 2018-03-26T10:07:17.287Z
Answers.UserDisplayName: igorpavlov
Answers.Body: <p>What are you trying to achieve exactly? Your solution works for the UI but will never catch any of the changes done via the API? </p>
  
  <p>So if you want to just catch the UI actions, your solution will be fine. But if you want to catch all changes to an option group you might miss a few.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-27T10:48:18.397Z
Answers.Text: Yes, I need to listen to changes via UI only.
Answers.UserDisplayName: igorpavlov
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-26T10:19:50.337Z
Answers.LastActivityDate: 2018-03-26T10:19:50.337Z
Answers.UserDisplayName: ErikH - CiviCooP
Body: <p>I would like to open such a modal programmatically and then listen to events related to this modal (such as "option created", "option updated", "modal closed" etc). I tried to look at the CiviCRM source code but could not find API for that. Is there such a possibility?</p>
  
  <p><a href="https://i.sstatic.net/wm2ji.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/wm2ji.png" alt="enter image description here"></a></p>
  
Tags: <api>
Title: How to programmatically open the option modal and listen to changes?
ThreadText: # How to programmatically open the option modal and listen to changes?
  
  (Asked by: username_0 on 2018-03-23)
  
  I would like to open such a modal programmatically and then listen to events related to this modal (such as "option created", "option updated", "modal closed" etc). I tried to look at the CiviCRM source code but could not find API for that. Is there such a possibility?
  
  [![enter image description here](https://i.sstatic.net/wm2ji.png)](https://i.sstatic.net/wm2ji.png)
  
  **Tags:** api
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2018-03-26. Score: 2 | Accepted answer
  
  It turned out to be possible:
  CRM.loadForm('/some/url')
    .on('crmFormSuccess', function (event, data) {
      // do smth
  });
  
  Ref: https://docs.civicrm.org/dev/en/latest/framework/ajax/
  
  
  ---
  
  ### Answer by username_1 on 2018-03-26. Score: 1
  
  What are you trying to achieve exactly? Your solution works for the UI but will never catch any of the changes done via the API?
  
  So if you want to just catch the UI actions, your solution will be fine. But if you want to catch all changes to an option group you might miss a few.
  
  > **Comments:**
  > **username_0**: Yes, I need to listen to changes via UI only.  
  
  ---
  
  