PDA

View Full Version : [HOW TO - vB 4.x] Adding Username Suggestion Dropdown


bananalive
29 Mar 2010, 15:28
This is a tutorial to show you how to add the username suggestion dropdown to your form as seen in image below.

http://www.vbulletin.org/forum/attachment.php?attachmentid=114959&d=1269872891

Add to the <head> of your template
<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>
Find and replace the <body> tag in your template with:
<body onload="setAjax()">
Add to your template where you want the username:
<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>