user_selector form helper not launching in modal

Permalink 1 user found helpful
Hey there,

I have a dashboard page on one of my packages in which I'm trying to leverage the user_selector form helper.

The issue is that, when I launch the selector, instead of opening in a modal, it goes to a new page sans any layout.

I'm using the page selector on the same page with no issue at all.

My code boils down to:

<?php
  $ush  = Loader::helper('form/user_selector');
  echo $ush->selectUser('userID',$userID);
?>


I've even tried this on a page all by itself to see if another element on the page was conflicting.

Anyone dug into this helper much?

jereme
 
jereme replied on at Permalink Best Answer Reply
jereme
This appears to be a bug in the user selector and how it specifies what the ccmActiveUserField value.

Out of the box, the helper generates this code:

<div class="ccm-summary-selected-item"><div class="ccm-summary-selected-item-inner"><strong class="ccm-summary-selected-item-label"></strong></div><a class="ccm-sitemap-select-item dialog-launch" onclick="ccmActiveUserField=this" dialog-width="90%" dialog-height="70%" dialog-modal="false" dialog-title="Choose User" href="/index.php/tools/required/users/search_dialog?mode=choose_one">Select User</a><input type="hidden" name="blogUserID" value="0"></div><script type="text/javascript">if (typeof(ccmActiveUserField) == "undefined") {var ccmActiveUserField;}
         ccm_triggerSelectUser = function(uID, uName, uEmail) {
           var par = $(ccmActiveUserField).parent().find('.ccm-summary-selected-item-label');
           var pari = $(ccmActiveUserField).parent().find('[name=blogUserID]');
           par.html(uName);
           pari.val(uID);
           }
      </script>


After staring at the working page selector code, I made a few modifications and it fired right up.

<div class="ccm-summary-selected-item"><div class="ccm-summary-selected-item-inner"><strong class="ccm-summary-selected-item-label"></strong></div><a class="ccm-sitemap-select-item dialog-launch" dialog-width="90%" dialog-height="70%" dialog-modal="false" dialog-title="Choose User" href="/index.php/tools/required/users/search_dialog?mode=choose_one">Select User</a><input type="hidden" name="blogUserID" value="0"></div>
<script type="text/javascript">
  var ccmActiveUserField;
  $(function() {
    $("a.ccm-sitemap-select-item").unbind();
    $("a.ccm-sitemap-select-item").dialog();
    $("a.ccm-sitemap-select-item").click(function() {
      ccmActiveUserField = this;
    });
  });
 ccm_triggerSelectUser = function(uID, uName, uEmail) {
   var par = $(ccmActiveUserField).parent().find('.ccm-summary-selected-item-label');
   var pari = $(ccmActiveUserField).parent().find('[name=blogUserID]');
   par.html(uName);
   pari.val(uID);


Any chance this correction could be made in the core?
focus43 replied on at Permalink Reply
focus43
Do you mind posting your modified file? And thanks for posting that fix too.
TheRealSean replied on at Permalink Reply
TheRealSean
Thanks for the solution