Categories | Question details Back To List | ||||||||
dhtmlxCombo select arrow appears on new line and doesn't work Hi, I have just started testing dhtmlCombo for my inline selects, which are in tables. However they are not working properly. The dropdown arrow is on a new a new line below the text box and when clicked, nothing happens. Any advice would be appreciated. Here's the snippet of my php code <?php for ($lt1 = 0; $lt1 < 4; $lt1++) { unset($selcategory); unset($selsubcategory); if ($lt1 == 0) { print("<table><tr width=100><td><strong>Category*</strong><br>"); } if ($catarray[$lt1][0]) { //if item already selected trap value $selcategory = $catarray[$lt1][0]; } else { $selcategory = $_POST["cat$lt1"]; } if ($lt1 > 0) { print("<table><tr><td>"); } if ($selcategory) { print("<select id=cat$lt1 name=catarray[".$lt1."][0]><option selected>".$selcategory."</option>"); } else { print("<select id=cat$lt1 name=catarray[".$lt1."][0]><option></option>"); } for ($lt = 0; $lt < pg_num_rows($dbcat); $lt++) { $cat = pg_result($dbcat, $lt, 0); if ($selcategory!=$cat) { print("<option>$cat</option>"); } } echo '</select>'; echo '<script>'; print ("var z=dhtmlXComboFromSelect('cat$lt1');"); echo 'z.enableFilteringMode(true);'; echo '</script>'; if ($lt1 == 0) { print("<td><strong>Subcategory</strong><br>"); } else { print("<td>"); } if ($catarray[$lt1][1]) { //if item already selected trap value $selsubcategory = $catarray[$lt1][1]; } else { $selsubcategory = $_POST["scat$lt1"]; } if ($selsubcategory) { print("<select id=subcat".$lt1." name=catarray[".$lt1."][1]'><option selected>$selsubcategory</option>"); } else { print("<select id=subcat".$lt1." name=catarray[".$lt1."][1]'>"); } for ($lt = 0; $lt < pg_num_rows($dbscat); $lt++) { $scat = pg_result($dbscat, $lt, 0); if ($selsubcategory!=$scat) { print("<option>$scat</option>"); } } echo '</select>'; echo '<script>'; print ("var z=dhtmlXComboFromSelect('subcat$lt1');"); echo 'z.enableFilteringMode(true);'; echo '</script>'; print("</td></tr></table>"); } ?> Answer posted by Alex (support) on Aug 25, 2009 03:22 Hello, please, provide the sample to recreate the issue (the result of php generation - html page, not php) Answer posted by barb on Aug 25, 2009 03:52 Here it is <table><tr width=100><td><strong>Category*</strong><br> <select id=cat0 name=catarray[0][0]><option></option> <option>Baking</option> <option>Beverage</option> <option>Breakfast</option> <option>Christmas</option> <option>Cleaning Product</option> <option>Confectionery</option> <option>Dessert</option> <option>Entree</option> <option>Finger Food</option> <option>Main Meal</option> <option>Marinade</option> <option>Side Dish</option> <option>Snack</option> <option>Spice Mix</option> </select><script>var z=dhtmlXComboFromSelect('cat0');z.enableFilteringMode(true);</script><td><strong>Subcategory</strong><br> <select style='width:200px;' id=subcat0 name=catarray[0][1]'> <option>Beef</option> <option>Biscuits</option> <option>Cakes</option> <option>Cereal</option> <option>Cheese</option> <option>Cheesecake</option> <option>Dip</option> <option>Dressing</option> <option>Egg</option> <option>Grains</option> <option>Lamb</option> <option>Pasta</option> <option>Pie</option> <option>Pork</option> <option>Poultry</option> <option>Pudding</option> <option>Salad</option> <option>Sauce</option> <option>Seafood</option> <option>Shake</option> <option>Slice</option> <option>Soup</option> <option>Test</option> <option>Veal</option> <option>Vegetables</option> </select><script>var z=dhtmlXComboFromSelect('subcat0');z.enableFilteringMode(true);</script></td></tr></table> Answer posted by Alex (support) on Aug 25, 2009 05:45 Javascript methods can not be called inside html tags. Try to place <script>var z=dhtmlXComboFromSelect('cat0');z.enableFilteringMode(true);</script> after </table> tag. The sample is attached Attachments (1)
Answer posted by barb on Aug 25, 2009 18:47 I tried that, and though it works fine in your sample, it doesn't in my page. There is a whole lot more going on in my page, so I am wondering if there isn't some other js conflicting with yours. Here is the entire source for my page <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <link rel="shortcut icon" href="images/favicon.ico" > <link rel="icon" href="images/animated_favicon1.gif" type="image/gif" > <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Web Recipe Manager</title> <meta name="keywords" content="Online Recipe Database Web Manager Management Recipes" /> <meta name="description" content="Web Based Recipe Management Software - store and manage your recipes on the web and access them from any PC, at any time, from anywhere, wherever you are" /> <link href="style.css" rel="stylesheet" type="text/css" media="screen" /> <script type="text/javascript" language="javascript" src="javascripts/jquery-1.3.1.min.js"></script> <script type="text/javascript" src="javascripts/jquery.ocupload-1.1.2.js"></script> <script type="text/javascript" src="javascripts/jquery.livequery.js"></script> <script type="text/javascript" src="javascripts/jquery.cookie.js"></script> <script src="dhtmlxCombo/codebase/dhtmlxcommon.js"></script> <script src="dhtmlxCombo/codebase/dhtmlxcombo.js"></script> <link rel="STYLESHEET" type="text/css" href="dhtmlx/dhtmlxcombo.css"> <script type="text/javascript" language="javascript"> window.dhx_globalImgPath="dhtmlxCombo/codebase/imgs/"; $(document).ready(function(){ var showinfo = $.cookie('showinfo'); // Set the user preference for showing informational text if (showinfo == 'on') { $('.info').show(); $('.hideinfo').show(); $('.showinfo').hide(); }; if (showinfo == 'off') { $('.info').hide(); $('.hideinfo').hide(); $('.showinfo').show(); }; //hide & show elements $('.hideinfo').click(function() { $(this).hide(); $('.info').hide(); $('.showinfo').show(); $.cookie('showinfo', 'off'); }); $('.showinfo').click(function () { $(this).hide(); $('.info').show(); $('.hideinfo').show(); $.cookie('showinfo', 'on'); }); $('#hideimg').livequery('click', function(event) { $(this).hide(); $('#progress1').hide(); $('#showimg').show(); $('#imagedisp').hide(); return false; }); $('#showimg').livequery('click', function(event) { $(this).hide(); $('#imagedisp').show(); $('#hideimg').show(); $('#showimg').hide(); return false; }); $('#hidemenu').click(function () { $('#sidebar').hide(); $('#showmenu').show(); $(this).hide(); return false; }); $('#showmenu').click(function () { $('#sidebar').show(); $('#hidemenu').show(); $(this).hide(); return false; }); $.each([0,1], function(i){ $('#hshowcat' + i).livequery('click',(function(i){ return function(event) { $(this).hide(); $('#showcat' + i).show(); $('#category' + i).show(); return false; } })(i + 1)); }); $('#hshowcat2').livequery('click',function(event) { $('#category3').show(); $(this).hide(); return false; }); $.each([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17], function(i){ $('#hshowing' + i).livequery('click',(function(i){ return function(event) { $(this).hide(); $('#showing' + i).show(); $('#ing' + i).show(); return false; } })(i + 1)); }); $('#hshowing18').livequery('click',function(event) { $(this).hide(); $('#ing19').show(); return false; }); $('#hshowing').livequery('click',function(event) { document.form1.elements['ingarray[' + 0 + '][' + 2 + ']'].selectedIndex = 0; $(this).hide(); $('#man_ing').hide(); $('#paste_ing').show(); $('#hshowman').show(); return false; }); $('#hshowman').livequery('click',function(event) { document.form1.ing.value=''; $(this).hide(); $('#paste_ing').hide(); $('#man_ing').show(); $('#hshowing').show(); return false; }); //message box $(window).scroll(function(){ $('#message_box').animate({top:$(window).scrollTop()+"px" },{queue: false, duration: 350}); }); $('#close_message').click(function() { $('#message_box').animate({ top:"+=150px",opacity:0 }, "slow"); }); //image upload $('#imagefl').upload({ name: 'file', method: 'post', enctype: 'multipart/form-data', action: 'upload.php', onSubmit: function() { $('#progress1').text('Uploading file...'); }, onComplete: function(data) { //data contains the response from the action url var image = $('div.image'); $(image).after('<div class=image id=imagedisp><img src="imagetmp/'+data+'"><br><a id=hideimg href="#">Hide image</a><input name=newimage type=hidden value='+data+'></div>'); $('#progress1').text(''); $(image).remove(); } }); }); function disableAll(){ var el = document.forms[0].elements; for(var i=0;i<el.length;i++){ el[i].setAttribute('disabled',true) } } </script> </head> <body><div> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="height:100%; background:url(images/bg_left.gif) left top repeat; "> <tr> <td width="50%" style="background:url(images/bg_left.gif) right top repeat; "></td> <table cellpadding="0" cellspacing="0" border="0" width="1100px" style="height:100%;"> <tr> <td> <table cellpadding="0" cellspacing="0" border="0" width="100%" style="height:70px; background:url(images/header.gif) center top no-repeat;"> <tr><td style=" background:url(images/bg_bottom_1.gif) center bottom no-repeat; "> <table cellpadding="0" cellspacing="0" border="0" width="980px" align="center"> <tr><td style="height:70px;"> <a href="index.html"><img src="images/button_spacer.gif" alt="" border="0"></a> <a href="display.php"><img src="images/button1.gif" alt="" border="0"></a> <a href="search.php"><img src="images/button2.gif" alt="" border="0"></a> <a href="awbs/aLogIn.php?als=YTo0OntzOjQ6InVzZXIiO3M6NDoiZGVtbyI7czo0OiJwYXNzIjtzOjY6ImRlbW8wMCI7czoxMDoibWFjY2Vzc2tleSI7czozMjoiYWM4ZjMxNDA2OTVhNWVlOGNhYmE1OTNhYmE2ZGQ4OGUiO3M6NToidWRhdGUiO2k6MTI1MTI1MDgwMjt9"><img src="images/button3.gif" alt="" border="0"></a> <a href="import.php"><img src="images/button4.gif" alt="" border="0"></a> <a href="awbs/kb.php"><img src="images/button5.gif" alt="" border="0"></a> </td></tr> </table> <table cellpadding='5' cellspacing='0' border='0' width='980px' align='center' bgcolor=#DFD3AE> <tr><td> <div id="hidemenu"><a href="#">Hide Menu</a></div> </td><td> <div id="showmenu" style="display: none"><a href="#">Show Menu</a></div> <br><table cellpadding="0" cellspacing="0" border="0" width="82" align="left" style=" height:18px;" class="order"><tr><td align="center" valign="middle" width="78" style="padding:3px 0px 0px 0px; background:url(wrmimages/recipes-btn_2_1.gif) left top no-repeat; "><a href="index-3.html" style="color:white;text-decoration:none;">BUY NOW</a></td><td><img src="wrmimages/recipes-spacer.gif" width="4" height="1" alt="Web Based Recipe Management Online"></td></tr></table></td></tr> <tr><td height="100%" style = "border-right: thin dotted #9E9A7B;"> <div id="sidebar"><h3 style="font-size:18px">Menu</h3> <script src="TreeMenu.js" language="JavaScript" type="text/javascript"></script> <script type="text/javascript"> //<![CDATA[ objTreeMenu_1 = new TreeMenu("\images", "objTreeMenu_1", "_self", "treeMenuDefault", true, false); newNode = objTreeMenu_1.addItem(new TreeNode('Import From File', 'ftv2doc.gif', 'import.php', false, true, '', '', null)); newNode = objTreeMenu_1.addItem(new TreeNode('Add Manually', 'ftv2doc.gif', 'addform.php', false, true, '', '', null)); newNode = objTreeMenu_1.addItem(new TreeNode('Export To File', 'ftv2doc.gif', 'export.php', false, true, '', '', null)); objTreeMenu_1.drawMenu(); objTreeMenu_1.writeOutput(); objTreeMenu_1.resetBranches(); // ]]> </script> </div> </td> <td height="100%"> <h2 style="font-size:18px">Add Recipe</h2> <form name='form1' action='' method=post enctype='multipart/form-data'> <table> <tr> <td> <INPUT type=submit name=save value=Save class=btn> </td> <td> <a href=display.php?id=><img src='images/display.jpg' style='border: none;'></a> </td> </tr> </table> <br> <br> <div class=info> Fields Marked With an * are mandatory<br><br> </div> <a href='#' class=hideinfo>Hide Informational Text</a> <a href='#' class=showinfo style='display:none'>Show Informational Text</a> <br> <br> <table border=0 cellpadding = 2 cellspacing = 1> <tr> <td> <strong>Name*</strong> </td> <td> <input type=text size=50 name='name' > </td> </tr> <tr> <td valign=top> <strong>Image</strong> </td> <td> <input type="hidden" name="MAX_FILE_SIZE" value="524288"> <input name='imagefl' id='imagefl' size=22.5 class='fle' type='file'> <span id="progress1"> Please ensure your image names don't contain any special characters like %</span><br> <div class=image id='imagedisp'> </div> <a href="#" id='showimg' style='display:none'>Show image</a> </td> </tr> <tr> <td> <strong>Measurement System</strong> </td> <td> </td> </tr> </table> <table><tr width=100><td><strong>Category*</strong><br> <select id=cat0 name=catarray[0][0]><option></option> <option>Baking</option> <option>Beverage</option> <option>Breakfast</option> <option>Christmas</option> <option>Cleaning Product</option> <option>Confectionery</option> <option>Dessert</option> <option>Entree</option> <option>Finger Food</option> <option>Main Meal</option> <option>Marinade</option> <option>Side Dish</option> <option>Snack</option> <option>Spice Mix</option> </select><td><strong>Subcategory</strong><br> <select style='width:200px;' id=subcat0 name=catarray[0][1]'> <option>Beef</option> <option>Biscuits</option> <option>Cakes</option> <option>Cereal</option> <option>Cheese</option> <option>Cheesecake</option> <option>Dip</option> <option>Dressing</option> <option>Egg</option> <option>Grains</option> <option>Lamb</option> <option>Pasta</option> <option>Pie</option> <option>Pork</option> <option>Poultry</option> <option>Pudding</option> <option>Salad</option> <option>Sauce</option> <option>Seafood</option> <option>Shake</option> <option>Slice</option> <option>Soup</option> <option>Test</option> <option>Veal</option> <option>Vegetables</option> </select><script>var z=dhtmlXComboFromSelect('cat0');z.enableFilteringMode(true);</script><script>var z=dhtmlXComboFromSelect('subcat0');z.enableFilteringMode(true);</script></td></tr></table> <table><tr><td> <select id=cat1 name=catarray[1][0]><option></option> <option>Baking</option> <option>Beverage</option> <option>Breakfast</option> <option>Christmas</option> <option>Cleaning Product</option> <option>Confectionery</option> <option>Dessert</option> <option>Entree</option> <option>Finger Food</option> <option>Main Meal</option> <option>Marinade</option> <option>Side Dish</option> <option>Snack</option> <option>Spice Mix</option> </select><td> <select style='width:200px;' id=subcat1 name=catarray[1][1]'> <option>Beef</option> <option>Biscuits</option> <option>Cakes</option> <option>Cereal</option> <option>Cheese</option> <option>Cheesecake</option> <option>Dip</option> <option>Dressing</option> <option>Egg</option> <option>Grains</option> <option>Lamb</option> <option>Pasta</option> <option>Pie</option> <option>Pork</option> <option>Poultry</option> <option>Pudding</option> <option>Salad</option> <option>Sauce</option> <option>Seafood</option> <option>Shake</option> <option>Slice</option> <option>Soup</option> <option>Test</option> <option>Veal</option> <option>Vegetables</option> </select><script>var z=dhtmlXComboFromSelect('cat1');z.enableFilteringMode(true);</script><script>var z=dhtmlXComboFromSelect('subcat1');z.enableFilteringMode(true);</script></td></tr></table> <table><tr><td> <select id=cat2 name=catarray[2][0]><option></option> <option>Baking</option> <option>Beverage</option> <option>Breakfast</option> <option>Christmas</option> <option>Cleaning Product</option> <option>Confectionery</option> <option>Dessert</option> <option>Entree</option> <option>Finger Food</option> <option>Main Meal</option> <option>Marinade</option> <option>Side Dish</option> <option>Snack</option> <option>Spice Mix</option> </select><td> <select style='width:200px;' id=subcat2 name=catarray[2][1]'> <option>Beef</option> <option>Biscuits</option> <option>Cakes</option> <option>Cereal</option> <option>Cheese</option> <option>Cheesecake</option> <option>Dip</option> <option>Dressing</option> <option>Egg</option> <option>Grains</option> <option>Lamb</option> <option>Pasta</option> <option>Pie</option> <option>Pork</option> <option>Poultry</option> <option>Pudding</option> <option>Salad</option> <option>Sauce</option> <option>Seafood</option> <option>Shake</option> <option>Slice</option> <option>Soup</option> <option>Test</option> <option>Veal</option> <option>Vegetables</option> </select><script>var z=dhtmlXComboFromSelect('cat2');z.enableFilteringMode(true);</script><script>var z=dhtmlXComboFromSelect('subcat2');z.enableFilteringMode(true);</script></td></tr></table> <table><tr><td> <select id=cat3 name=catarray[3][0]><option></option> <option>Baking</option> <option>Beverage</option> <option>Breakfast</option> <option>Christmas</option> <option>Cleaning Product</option> <option>Confectionery</option> <option>Dessert</option> <option>Entree</option> <option>Finger Food</option> <option>Main Meal</option> <option>Marinade</option> <option>Side Dish</option> <option>Snack</option> <option>Spice Mix</option> </select><td> <select style='width:200px;' id=subcat3 name=catarray[3][1]'> <option>Beef</option> <option>Biscuits</option> <option>Cakes</option> <option>Cereal</option> <option>Cheese</option> <option>Cheesecake</option> <option>Dip</option> <option>Dressing</option> <option>Egg</option> <option>Grains</option> <option>Lamb</option> <option>Pasta</option> <option>Pie</option> <option>Pork</option> <option>Poultry</option> <option>Pudding</option> <option>Salad</option> <option>Sauce</option> <option>Seafood</option> <option>Shake</option> <option>Slice</option> <option>Soup</option> <option>Test</option> <option>Veal</option> <option>Vegetables</option> </select><script>var z=dhtmlXComboFromSelect('cat3');z.enableFilteringMode(true);</script><script>var z=dhtmlXComboFromSelect('subcat3');z.enableFilteringMode(true);</script></td></tr></table> <!--</div>--> <br> <strong>Directions*</strong> <div class=info> Here's the character for degrees celsius and fahrenheit if you need them ℃ ℉ </div> <br><TEXTAREA name='directions'></TEXTAREA><br> <strong>Notes</strong> <br><TEXTAREA style='height:30px;' name='note'></TEXTAREA><br><br> <table border=0 cellpadding = 2 cellspacing = 1> <tr> <td> <strong>Source</strong> </td> <td> </td> <td> <strong>Rating</strong> </td> <td> <select name=rating><option></option><option>Not Rated</option><option>1 Star</option><option>2 Stars</option><option>3 Stars</option><option>4 Stars</option><option>5 Stars</option></select> </td> <td> <strong>Tried</strong> </td> <td> <input class=chk type=checkbox name='tried' > </td> </tr> <tr> <td> <strong>Cuisine</strong> </td> <td> </td> </td> <td> <strong>Makes</strong> </td> <td> <input class=smallinp type=text name='yield' > </td> </td> <td> <strong>Prep Time</strong> </td> <td> <input class=smallinp type=text name='preptime' value=''> </td> </tr> </table> <table> <tr> <td> <strong>Diet/s</strong><br> <select name=diet[] multiple size=20 onChange='checkAdd(this)'> <option>Alkaline</option><option>Dairy Free</option><option>Gluten Free</option><option>Low Carb</option><option>Low Fat</option><option>Southbeach</option> <option>Other</option></select> </td> <td> <strong>Related Recipe/s</strong><br> <select name=related_recipe[] multiple size=20'> <option>Almond Cookies</option><option>Avocado & Prawn Couscous With Lime</option><option>Babi Kecap I (Pork Cooked In Soya Sauce)</option><option>Bacon Cheeseburger Quiche</option><option>Baked Vegetable Omelette</option><option>Barley Chili</option><option>Barley Pilaf</option><option>Barley Risotto With Spinach And Parmesan</option><option>Beef Smoore</option><option>Beer Butt Chicken</option><option>Black, White, And Green Bean Salad</option><option>Blue Cheese Ranch Dressing</option><option>Broccoli Rabe</option><option>Caesar Salad With Dressing</option><option>Cajun Prawns</option><option>Cheddar Bacon Devilled Eggs</option><option>Cheesy Potatoes</option><option>Cheesy Spinach</option><option>Chermoula Chicken</option><option>Chicken And White Bean Chili</option><option>Chicken Barley Soup</option><option>Chicken Breast Salad With Balsamic Vinegar</option><option>Chicken Caesar Salad</option><option>Chicken Curry</option><option>Chicken Noodle Soup</option><option>Chili Con Carne</option><option>Chocolate Crackles</option><option>Cinnamon Yoghurt Creme</option><option>Coriander Cream Chicken</option><option>Creamy Tarragon Chicken</option><option>Crunchy Cheese And Herb Chicken Schnitzels</option><option>Cumin-Scented Chicken Tikka</option><option>Curry-Rubbed Salmon</option><option>Curry Powder</option><option>Custard Fruit Cake</option><option>Deviled Eggs With Horseradish And Scallions</option><option>Dijon Prawn Cocktail</option><option>Easy Salmon Cakes</option><option>Easy Veggie Chili</option><option>Festive Yoghurt</option><option>Golden Dream</option><option>Grandma's Custard Fruit Cake</option><option>Grandma's Potato Salad</option><option>Granola</option><option>Green Tea And Chicken Stirfry</option><option>Ham And Cheese Pita Melt</option><option>Ham And Chicken Gumbo</option><option>Ham Tomato And Spinach Salad</option><option>Hasselback Potatoes With Spice Topping</option><option>Hearty Minestrone</option><option>Homemade Spaghetti</option><option>Icecream With Kiwifruit Sauce</option><option>Jalapeño Chicken Salad</option><option>Key Lime Pie</option><option>Lamb With Yoghurt, Coconut Milk & Almond Masala</option><option>Lemon Cheesecake</option><option>Lemon Pancake</option><option>Lemon Sago Dessert</option><option>Lemon Zest Yoghurt</option><option>Margarita</option><option>Mediterranean Salmon</option><option>Microwave Bacon Omelet</option><option>Microwave Baked Apple</option><option>Microwave Veal Paprika</option><option>Mischievous Eggs</optio Answer posted by Alex (support) on Aug 26, 2009 01:53 Hello, the issue doesn't relate to combo component. there are a lot of issues in the html structure - all tags should be closed. And moreover you still calls JavaScript methods inside html tags. Please, use sample provide before as an example for your page. |