Quote:
Originally Posted by hoochblues
Any suggestions on how I might create a field on the form that is a dropdown list of users on the forum?
Or even better, a box in which to enter usernames similar to that in Tournaments & Ladders? Where they are validated against the user base?
|
I wouldn't suggest a dropdown list as it would be very big.
Create a custom question, with the following php code:
PHP Code:
$answer = '<script type="text/javascript" src="clientscript/vbulletin_ajax_suggest.js?v={vb:raw vboptions.simpleversion}"></script>'."\r\n";
$answer .= ' <script type="text/javascript"><!--'."\r\n";
$answer .= ' function setAjax()';
$answer .= ' {';
$answer .= ' if (document.getElementById(\'userfield\'))';
$answer .= ' {';
$answer .= ' snc = new vB_AJAX_NameSuggest(\'snc\', \'userfield_txt\', \'userfield\');';
$answer .= ' snc.allow_multiple = false;';
$answer .= ' }';
$answer .= ' }'."\r\n";
$answer .= ' --></script>'."\r\n";
$answer .= '<div id="userfield" class="popupmenu nomouseover noclick nohovermenu"> <input class="primary full textbox popupctrl" name="'.$formbit['id'].'" id="userfield_txt" tabindex="1" autocomplete="off" value="'.$formbit['value'].'" /> </div>';
Then: Edit Form -> Form PHP Hooks -> Form Hook: Form Start:
PHP Code:
$vbulletin->templatecache['shell_blank'] = str_replace('<body>','<body onload="setAjax()">', $vbulletin->templatecache['shell_blank']);