PDA

View Full Version : Name Suggest for input box in a custom page


AF_staff
03-08-2011, 01:12 PM
Hi,

I would like to implement the function name suggest into an input box for a mod I am currently working on but I cannot make it work. I found a similar thread (https://vborg.vbsupport.ru/showthread.php?t=230489&highlight=name+suggest) but it doesn't provide a possible solution for my concern so I hope someone can help me out.

I was already able to grab the code from private message template and make it work in a custom page.

https://vborg.vbsupport.ru/external/2011/03/38.png

The textarea at the top is exactly the same as what can be seen in private messaging. The exact code is

<div class="blockrow">
<label for="pmrecips_ctrl" class="floatcontainer full">

</label>
<script type="text/javascript" src="clientscript/vbulletin_ajax_suggest.js?v={vb:raw vboptions.simpleversion}"></script>
<div id="usernamelist" class="popupmenu nomouseover noclick nohovermenu">

<textarea class="primary full textbox popupctrl" id="username_ctrl" name="recipients" rows="{vb:if is_browser('mozilla'), 1, 2}" cols="50" tabindex="1">{vb:raw pm.recipients}</textarea>
</div>

<script type="text/javascript">
<!--
username_sugg = new vB_AJAX_NameSuggest('username_sugg', 'username_ctrl', 'usernamelist');

//-->
</script>

</div>


I would like to apply the same for the input box, the one below the text To[Enter Username]

I applied the following code based on the pm code



<td class='alt1' align='center' width='50%'>
<script type="text/javascript" src="clientscript/vbulletin_ajax_suggest.js?v={vb:raw vboptions.simpleversion}"></script>
<div id="usernamelist" class="popupmenu nomouseover noclick nohovermenu">

<input type='text' class='bginput' name='to' value='{vb: raw to}' id="username_ctrl">
</div>
<script type="text/javascript">
<!--
username_sugg = new vB_AJAX_NameSuggest('username_sugg', 'username_ctrl', 'usernamelist');

//-->
</script>

</td>
</tr>


I have id for the input, it's username_ctrl... I based everything on the first code so I wonder what's wrong? Any ideas?

Thanks in advance!