Categories | Question details Back To List | ||||||||||||||
combox does not always return altered value. I have a combobox which fetches the username from a mysql table, when i type a characte, it pulls all the names starting with that character, so far so good. The actual problem is when value in the combobox is not from the database, manually altered value, then sometimes the value is not captured in the POST method, however the "COMBO_new_value" is captured properly. please help. Answer posted by Support on Nov 27, 2008 04:15 Most probably focus wasn't moved out from the combo, before sending the request to the server side. You can try to add the next line to the combo's init combo.attachEvent("onSelectionChange",combo._confirmSelection); Answer posted by Kris A on Nov 27, 2008 04:41 Hi, Thanks for responding so quickly. I still have the same issue. I dont think its a focus issue. I am not sure really. Heres the part of the code. <table width="100%" border="0" style="border:none;font-size:11px; color:#000000;"> </td> and in add.php if i print $_POST, this is wht i get Array ( [other] => [other_new_value] => true [button1] => Add ) This is happening only for altered values, some time it captures, sometimes it doesnt, and for values returned from the mysql table, they are captured properly.
Answer posted by Support on Nov 27, 2008 07:38 Problem can't be reconstructed locally. Both values changed in the same place of code - so it doesn't look possible to have them desynced. Are you using any other combo events? You can try to add one more change. <form id="form10" onsubmit="z1.confirmSelection()" ... If issue still occurs - please provide any kind of sample of demo link where issue can be reconstructed Answer posted by Kris A on Nov 28, 2008 02:13 Hi, This is very easily reproduceable, I have checked with 3 more PC's and this happens in all the machines. Following are code where the problem can be seen. Test.html <body> addAttendeesToTempTable.php <?php print_r($_POST) ?> Results: Array ( [other] => [other_new_value] => true [button1] => Add ) Not all the time, the POST['other'] is blank, sometimes it does captures values.
Answer posted by Kris A on Nov 28, 2008 02:19 I cant provide a link, because this is within an intranet network, but the code above will reproduce it, 1. Manually type some values in the combo box and click add, and check in the server if its captured. 2. if yes, go back, refresh page, and do step one. The issue will happen b/w 1 and 2. certain. Answer posted by Kris A on Nov 28, 2008 02:47 One more thing i notice now is , and i believe this will help support, 1. I type K, and the drop down is filled with list of names starting with K, and I chose 'Kris', 2. Edit this entry in the combobox by appended ' A' at the end, so the final value in the combo looks like 'Kris A' 3. Submit this and i see that the captured value is 'Kris' and NOT 'Kris A'
Answer posted by Kris A on Nov 28, 2008 03:15 Further, when i remove z1.enableFilteringMode(true,"complete.php",true); from the code, and enter values into the combobox, they are properly captured in the server, just like a normal html <select>. The problem only occurs when i include the complete.php file in the filtering mode. its an erractic behavior like i said. so that leads me to believe if there is a problem in the complete.php file, because i altered it to fit my needs. I have attached the file for your reference. Finally , I aplogize for submitting several posts , we have an intranet app coming up and i need this combo box, and after seeing what DHTMLX can do, i am thrilled. Kindly help us fix this. Best, Kris A Attachments (1)
Answer posted by Support on Nov 28, 2008 03:35 Hi Kris The issue still can not be reproduced... The php file which you are provided looks correct. I have attached the sample. Attachments (1)
Answer posted by Kris A on Nov 28, 2008 04:15 Hi , I am not sure why u guys are unable to reproduce it, however could it be because i am using 2 combobox in a single page. Could it be somethin to do with some initialization?? , my first combo looks like <td bgcolor="#CCCCCC"> second combobox looks like: <td width="47%" align="left" style="border:none;"><b>Others: </b> <div id="otherC" style="width:100px;"></div> However I have found a solution, and untill you guys get more data on this, this solution might help somebody else. 1. The complete.php has $_GET['mask'], this contains the value currently in the combobox. whether from the db or altered, that value resides in $_POST['mask']; 2. Write this value into a file/session. 3. In the collecting server page, just check if $_POST['whatever is the value of the combo box'] is blank (" "), if it is, read from the session/file(file_get_contents) else, read from the combo box. All altered values are captured in the $_POST['mask'] so your file will have the altered entry. just make sure the file gets rewritten everytime.("w+" mode).
Answer posted by Support on Nov 28, 2008 06:02 Unfortunately we still not able to reconstruct issue locally, the sample attached to previous email, uses the same init but works correctly. We will check the possible reasons, but sor far it works correctly in the same scenario in local tests Answer posted by Kris A on Nov 28, 2008 06:46 Thats ok, atleast if another occurence of this happens, you guys will atleast have some data. For now, i am happy with the solution and the combobox, its fantastic. However I just have to say that, in my experience i have encountered only a very few support teams whose response is as quick as yours. very commendable. Keep up the good work. Answer posted by Guttorm on Mar 31, 2009 07:05 Hi I was having similar problems. And it was hard to reproduce. Here is what I first did: <form action="..." method="post" onSubmit="return verify(this);"> <div id="mycombo_div"></div> .. other stuff in the form <script> var z1 = new dhtmlXCombo("mycombo_div","mycombo_col",250); z1.enableFilteringMode(true,'complete.php',true); </script> </form> <script> function verify(f) { if (z1.getComboText() != z1.getActualValue()) { alert("You are quick"); return false; } return true; } </script> I managed to get the alert when I put it on a remote server, typed fast, and clicked the submit button quickly after typing some text in the combo. My guess is, it was accessing complete.php while the form was submitted. So I changed the verify function to this: function verify(f) { z1.setComboValue(z1.getComboText()); return true; } It seems it solved the problem. |