1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Connection between autocomplete and XenForo_ControllerPublic_Member::actionFind

Discussion in 'XenForo Development Discussions' started by chrisj, Jul 25, 2012.

  1. chrisj

    chrisj Active Member

    I noticed how even with this little html
    <input class="AutoComplete" />
    XenForo was able to link it with XenForo_ControllerPublic_Member::actionFind.

    How can I change this so that it will call actionFind for a different controller?

    I probably have to understand XenForo_Template_Compiler_Tag_Admin_TextBoxUnit to do it but I was hoping someone could help explain it to me.
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    The action is in the javascript:


    	XenForo.AutoComplete = function($element) { this.__construct($element); };
    	XenForo.AutoComplete.prototype =
    		__construct: function($input)
    			this.$input = $input;
    			if (XenForo.AutoComplete.defaultUrl === null)
    				if ($('html').hasClass('Admin'))
    					XenForo.AutoComplete.defaultUrl = 'admin.php?users/search-name&_xfResponseType=json';
    					XenForo.AutoComplete.defaultUrl = 'index.php?members/find&_xfResponseType=json';
    If you are comfortable with javascript then you can write your own function to call a different action. Or you can extend XenForo_ControllerPublic_Member::actionFind to reroute to a different controller and action. You can reroute by having the controller return this:

    return $this->responseReroute('YOU_ControllerPublic_YOURCONTROLLER', 'ACTION');
  3. ragtek

    ragtek Guest

    you don't need to:p

    under the code from jake you'll find
    this.url = $input.data('acUrl') || XenForo.AutoComplete.defaultUrl;
    which means => add your own acUrl data field and enjoy it;)
    chrisj and Jake Bunce like this.

Share This Page