Back to vBulletin Tips & Tricks

[HOW TO - vB 4.x] Adding Username Suggestion Dropdown
by bananalive 29 Mar 2010

This is a tutorial to show you how to add the username suggestion dropdown to your form as seen in image below.

  1. Add to the <head> of your template
    HTML Code:
     <script type="text/javascript" src="clientscript/vbulletin_ajax_suggest.js?v={vb:raw vboptions.simpleversion}"></script>
        <script type="text/javascript">
            function setAjax()
            {
                if (document.getElementById('userfield'))
                {
                    snc = new vB_AJAX_NameSuggest('snc', 'userfield_txt', 'userfield');
                }
            }
        </script>
  2. Find and replace the <body> tag in your template with:
    HTML Code:
    <body onload="setAjax()">
  3. Add to your template where you want the username:
    HTML Code:
       <div class="blockrow">
            <label for="userfield_txt">{vb:rawphrase username}</label>
            <ul class="multifield group">
                <li>
                    <div id="userfield" class="popupmenu nomouseover noclick nohovermenu">
                        <input type="text" class="textbox popupctrl" name="username" id="userfield_txt" tabindex="1" />
                    </div>
                </li>
            </ul>
        </div>
Attached Thumbnails
Click image for larger version
Name:	username_dropdown.jpg
Views:	225
Size:	6.0 KB
ID:	114959  

vblts.ru supports vBulletin®, 2022-2024