dlyles Posted December 1, 2006 Share Posted December 1, 2006 I am trying to create a dependant drop down menu where when the user selects a group, a list of models comes up based on that group. I got this code from another site and modified it, but can't get it to work. Any ideas? Quote Link to comment Share on other sites More sharing options...
dlyles Posted December 1, 2006 Author Share Posted December 1, 2006 for some reason i am unable to edit the post or place the code in it's entirety. Until than, I'll have to hold off on request for help. Quote Link to comment Share on other sites More sharing options...
ober Posted December 1, 2006 Share Posted December 1, 2006 If you have JS script tags in the code, remove them... then you should be able to post it. Quote Link to comment Share on other sites More sharing options...
dlyles Posted December 1, 2006 Author Share Posted December 1, 2006 Thank you.I am trying to create a dependant drop down menu where when the user selects a group, a list of models comes up based on that group. I got this code from another site and modified it, but can't get it to work. Any ideas?THE HEAD TAG[code]var ajax = new sack();function getmodelList(sel){ var GroupCode = sel.options[sel.selectedIndex].value; document.getElementById('dhtmlgoodies_model').options.length = 0; // Empty model select box if(GroupCode.length>0){ ajax.requestFile = 'getmodelinfo.php?GroupCode='+GroupCode; // Specifying which file to get ajax.onCompletion = createCities; // Specify function that will be executed after file has been found ajax.runAJAX(); // Execute AJAX function }}function createCities(){ var obj = document.getElementById('dhtmlgoodies_model'); eval(ajax.response); // Executing the response from Ajax as Javascript code } [/code]THE BODY[code]$query = "SELECT * FROM groups";$result = mysql_query($query) or die ("query 1 failed");$count = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { echo '<option value="'.$row['GroupID'].'">'.$row['GroupName'].'</option>';}echo '</select>';[/code]LASTLY, HERE'S THE getmodelInfo.php[code]if(isset($_POST['dhtmlgoodies_model']) AND isset($_GET['dhtmlgoodies_model'])){ $yr = mysql_real_escape_string($_POST['dhtmlgoodies_group']); $query = "SELECT * FROM models WHERE GroupID=$yr";$result = mysql_query($query) or die ("query 1 failed");$count = mysql_num_rows($result); while ($row = mysql_fetch_array($result)) { echo '<option value="'.$row['ModelID'].'">'.$row['ModelName'].'</option>';}echo '</select>';[/code] Quote Link to comment Share on other sites More sharing options...
ober Posted December 1, 2006 Share Posted December 1, 2006 and.... where did you get your example from? Because you're not doing anything with the response, you don't have an area in your Body that you have set for updating (unless you're not showing the entire thing), and you're not handling the response correctly.Honestly, it looks like there's a bunch of custom 3rd party code/functions that you're calling and we can't really help you with that. If you want to scrap it and start over from scratch, we can help you. Quote Link to comment Share on other sites More sharing options...
dlyles Posted December 1, 2006 Author Share Posted December 1, 2006 I got the code from dhtml goodies. I would love to scratch it and start from scratch, just unsure where scratch is :(I'd appreciate ANY help. Quote Link to comment Share on other sites More sharing options...
ober Posted December 1, 2006 Share Posted December 1, 2006 Look at the sticky thread in this board. Or better yet, read through the tutorials on www.ajaxfreaks.com. Or search this board for examples that I created. Quote Link to comment Share on other sites More sharing options...
dlyles Posted December 1, 2006 Author Share Posted December 1, 2006 Checking now. Quote Link to comment Share on other sites More sharing options...
dlyles Posted December 1, 2006 Author Share Posted December 1, 2006 Ok, I'm confused :( Quote Link to comment Share on other sites More sharing options...
ober Posted December 1, 2006 Share Posted December 1, 2006 You might want to tell us what you're confused about.Maybe this tutorial will help you a little better. http://www.ajaxfreaks.com/tutorials/6/1.php 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.