rendered paste body brand = document.getElementById('brand'); brand.style.display = 'none'; function next(selected) { // var selected = selected; if(selected == "global") { // call the brands down via ajax } else if(selected == "brand") { xajax_getBrands(); } }<form action="?action=manage_settings&do=add&formsubmitted=true" method="POST" name="settings"> <div class="row"> <label for="settingtype">Setting Type:</label> <select name="settingtype" id="settingtype" onchange="next(this.options[this.selectedIndex].value);"> <option label="global" value="global">Global</option> <option label="brand" value="brand">Brand</option> <option label="build" value="build">Build</option> <option label="number" value="number">Number</option> </select> </div> <div class="row" id="brand"> <select name="brandid" id="brandid"> {html_options values=$brands.brandid output=$brands.name} </select> </div> <div class="row"> <input type="submit" value="Add settings"> </div></form>