Answers.Body: <p>By default, Garnish.Modal will automatically close other modals when <a href="https://github.com/pixelandtonic/Garnish/blob/master/Source/classes/Modal.js#L91" rel="nofollow"><code>show()</code></a> is called (which happens automatically when you first create it).</p>
  
  <p>That behavior can be overridden by setting the <code>closeOtherModals</code> setting to <code>false</code>, though:</p>
  
  <pre class="lang-js prettyprint-override"><code>var myModal = new Garnish.Modal($container, {
      closeOtherModals: false
  });
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-13T15:33:32.173Z
Answers.Text: Thanks, problem is the forms.elementSelect (users) window is the one causing the conflict. I open my window, click add user and it opens the user select window and hides my orignal. So when I close user select, my 1st window is gone.
  
  For now I'll probably just move this to another template and not to a modal.
Answers.UserDisplayName: Adam McCombs
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-08-13T14:16:30.867Z
Answers.LastActivityDate: 2014-08-13T14:16:30.867Z
Answers.UserDisplayName: Brandon Kelly
Body: <p>Is there a way to override Garnish.Modal? </p>
  
  <p>For example, I have a custom modal which uses a custom form but I want to be able to use the built in forms.elementSelect to select from a user list. When I select a user and press "select" it closes both my custom modal and my user select window. </p>
  
  <p><strong>Can I override this to just close the most recent modal?</strong></p>
  
  <p>This is in reference to Custom Modals inside Plugins: <a href="https://craftcms.stackexchange.com/q/374/45">How can my plugin generate a generic modal window in the Control Panel?</a></p>
  
  <p><strong>Edit:</strong> It looks as if Garnish hides any other modals before loading a new one.</p>
  
Tags: <plugin-development><modal><garnish>
Title: Possible to override Garnish.Modal? [Plugin]
ThreadText: # Possible to override Garnish.Modal? [Plugin]
  
  (Asked by: username_0 on 2014-08-12)
  
  Is there a way to override Garnish.Modal?
  
  For example, I have a custom modal which uses a custom form but I want to be able to use the built in forms.elementSelect to select from a user list. When I select a user and press "select" it closes both my custom modal and my user select window.
  
  **Can I override this to just close the most recent modal?**
  
  This is in reference to Custom Modals inside Plugins: [How can my plugin generate a generic modal window in the Control Panel?](https://craftcms.stackexchange.com/q/374/45)
  
  **Edit:** It looks as if Garnish hides any other modals before loading a new one.
  
  **Tags:** plugin-development, modal, garnish
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-08-13. Score: 1 | Accepted answer
  
  By default, Garnish.Modal will automatically close other modals when [`show()`](https://github.com/pixelandtonic/Garnish/blob/master/Source/classes/Modal.js#L91) is called (which happens automatically when you first create it).
  
  That behavior can be overridden by setting the `closeOtherModals` setting to `false`, though:
  
  ```js
  var myModal = new Garnish.Modal($container, {
      closeOtherModals: false
  });
  
  ```
  
  > **Comments:**
  > **username_0**: Thanks, problem is the forms.elementSelect (users) window is the one causing the conflict. I open my window, click add user and it opens the user select window and hides my orignal. So when I close user select, my 1st window is gone.  For now I'll probably just move this to another template and not to a modal.  
  
  ---
  
  