atholon Posted March 8, 2008 Share Posted March 8, 2008 OK dokey, here is my problem. I have a script that I am enabling users to use a select box to select a category for a tutorial they will submit. Then they select certain categories certain results are displayed as sub categories then when they choose certain sub categories certain programs are displayed according to the sub category. Anywho so I have this for the JS to watch for the initial change var internalCat = document.getElementById('internalCat'); var externalCat = document.getElementById('externalCat'); if( internalCat ) { internalCat.sbname = "internalSubCatSelect"; internalCat.result = "internalSubCat"; internalCat.onchange = ToggleCatText; } if( externalCat ) { externalCat.sbname="externalSubCatSelect"; externalCat.result="externalSubCat"; externalCat.onchange = ToggleCatText; } Then when they are toggled the ToggleCatText function executes which uses an Ajax.Updater() to retrieve the results in the php file. new Ajax.Updater(catView, '../tutorials/process/catView.php?view=' + display + '&selectBoxName=' + selectBoxName, {asynchronous:false}); Then it is supposed to pass back the results like this: $parentCategory = $_REQUEST['view']; $selectBoxName = $_REQUEST['selectBoxName']; $html = ''; $html .= "<select id=\"$selectBoxName\" name=\"$selectBoxName\">"; $count = 1; $query=mysql_query("SELECT title FROM subcategories WHERE parent = '{$parentCategory}' ORDER BY title ASC"); if( mysql_num_rows($query) > 0 ) { while($result=mysql_fetch_array($query)) { if ($count == 1) { $html .= "<option value=\"{$result['title']}\" selected=\"{$result['title']}\">{$result['title']}</option> "; } else { $html .= "<option value=\"{$result['title']}\" >{$result['title']}</option> "; } } mysql_free_result($query); } else { } $html .= "</select>"; echo $html; Thing is for some reason when I try to use the var internalSubCatSelect = document.getElementById('internalSubCatSelect'); var externalSubCatSelect = document.getElementById('externalSubCatSelect'); It won`t trigger anything using onchange.... any ideas? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.