<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
	<title>jQuery Grid Plugin - jqGrid - Topic: FormEdit : select does not have the right default value</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value</link>
	<description><![CDATA[Grid plugin]]></description>
	<generator>Simple:Press Version 5.7.5.3</generator>
	<atom:link href="http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>eagle on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18521</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18521</guid>
        	        	<description><![CDATA[<p>Hi all. I&#39;m also faced with this issue.</p>
<p>In case of using dataUrl with edittype "select", when we open modal form (adding row for example),</p>
<p>content of select field ajax-ed from server-side php-scripts.</p>
<p>And in case of using Safari/Chrome selects not display default values</p>
<p>For example in Safari my modal form for add-action looks like this</p>
<p><a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://imageshost.ru/&#39;);" href="http://imageshost.ru/" target="_blank">[Image Can Not Be Found]</a></p>
</p>
<p>In case of Google Chrome modal form looks similar&#160;</p>
<p><a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://imageshost.ru/&#39;);" href="http://imageshost.ru/" target="_blank">[Image Can Not Be Found]</a></p>
</p>
<p>But in FireFox all seems good</p>
<p><a onclick="javascript:pageTracker._trackPageview(&#39;/outbound/article/http://imageshost.ru/&#39;);" href="http://imageshost.ru/" target="_blank">[Image Can Not Be Found]</a></p>
</p>
<p>My server-side php-script looks like this in my example</p>
<p>&#60;?php</p>
<p>session_start();</p>
<p>include_once("../../incl/mysql_config.inc");</p>
<p>require ("../../incl/auth.inc");</p>
<p>//$n=1;</p>
<p>$spr_user_groups = "&#60;select&#62;";</p>
<p>$r = mysql_query("select * from user_groups order by group_name asc");</p>
<p>while ($row=mysql_fetch_array($r)) {</p>
<p>$spr_user_groups .= "&#60;option value=&#39;".$row[&#39;id&#39;]."&#39;&#62;".$row[&#39;group_name&#39;]."&#60;/option&#62;";</p>
<p>}</p>
<p>$spr_user_groups .= "&#60;/select&#62;";</p>
<p>print $spr_user_groups;</p>
<p>?&#62;</p>
</p>
<p>And my colModel part in jqGrid is:</p>
</p>
<p>{name:"group_name",index:"group_name",editable:true,edittype:"select",</p>
<p>editoptions:{dataUrl:"ajax/switches/select_user_groups.php"},hidden:false,align:"center",search:true,width:8},</p>
</p>
<p>Anybody know how to fix this behavior?</p>
<p>Oh, I forget to say, that in my case I use&#160;</p>
<p>"recreateForm:true"</p>
<p>If I set&#160;</p>
<p>"recreateForm:false"</p>
<p>modal form display correct on second open-form action</p>
</p>
<p>Sorry for my English <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_smile.gif" alt=":)" /></p>
]]></description>
        	        	<pubDate>Sat, 10 Jul 2010 10:33:13 +0300</pubDate>
        </item>
        <item>
        	<title>tony on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18296</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18296</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>For me is really difficult to determine what is happen. In order to resolve, please provide a link to the problem.</p>
<p>If you do so please, do not include the grid min file, but the non minified source code.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 30 Jun 2010 15:35:48 +0300</pubDate>
        </item>
        <item>
        	<title>gseroul on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18248</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18248</guid>
        	        	<description><![CDATA[<p>Hi Tony, any idea or tests that I can do ?</p>
]]></description>
        	        	<pubDate>Mon, 28 Jun 2010 16:24:28 +0300</pubDate>
        </item>
        <item>
        	<title>gseroul on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18192</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18192</guid>
        	        	<description><![CDATA[<p>I also tried with 3.6.5 and same behaviour.</p>
]]></description>
        	        	<pubDate>Fri, 25 Jun 2010 11:07:05 +0300</pubDate>
        </item>
        <item>
        	<title>gseroul on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18185</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18185</guid>
        	        	<description><![CDATA[<p>The last one : 3.7.1</p>
]]></description>
        	        	<pubDate>Fri, 25 Jun 2010 10:33:05 +0300</pubDate>
        </item>
        <item>
        	<title>tony on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18184</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18184</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Which version is used? I think this bug is fixed, but could not remember in wich version.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 25 Jun 2010 10:29:25 +0300</pubDate>
        </item>
        <item>
        	<title>gseroul on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18181</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18181</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>Thanks to take time to check my code.</p>
<p>Here is the line in my grid :</p>
<table id="list" class="ui-jqgrid-btable" border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr id="0" class="ui-widget-content  jqgrow ui-row-ltr ui-state-hover">
<td title="FZ020822">FZ020822</td>
<td title="24/06/2010">24/06/2010</td>
<td title="plate_5_hampton">plate_5_hampton</td>
<td title="Imaging Robot 20">Imaging Robot 20</td>
<td title="crystalquick_sw">crystalquick_sw</td>
</tr>
</tbody>
</table>
<p>When I edit the line the first time I have this code returning from my server through the ajax request :</p>
<p><em>&#60;select&#62;<br />&#60;option value=&#39;1&#39;&#62;crystalquick_rw&#60;/option&#62;<br />&#60;option value=&#39;3&#39;&#62;corning_96&#60;/option&#62; &#60;option value=&#39;4&#39;&#62;corning_192&#60;/option&#62; <br />&#60;option value=&#39;8&#39;&#62;crystalquick_sw_nextal&#60;/option&#62;<br />&#60;option value=&#39;9&#39;&#62;crystalquick_sw+&#60;/option &#62;<br />&#60;option value=&#39;10&#39;&#62;crystalquick_sw_treated&#60;/option&#62;<br />&#60;option value=&#39;11&#39;&#62;crystalquick_sw_lbr&#60;/option&#62; <br />&#60;option value=&#39;15&#39;&#62;greiner sw lbr&#60;/option&#62;<br />&#60;option value=&#39;2&#39;&#62;crystalquick_sw &#60;/option&#62;<br />&#60;option value=&#39;17&#39;&#62;crystalquick_hd2&#60;/option&#62; <br />&#60;/select&#62; </em></p>
<p>But in this edit form the 1st value of the list (<em> &#60;option value=&#39;1&#39;&#62;crystalquick_rw&#60;/option&#62;</em> ) is selected and not this one</p>
<p>as expected : <em>&#60;option value=&#39;2&#39;&#62;crystalquick_sw&#60;/option&#62; </em></p>
</p>
<p>If I close the edit form and re-edit the same line (or another line) then the default selected value is the right one comparing</p>
<p>to the value in the grid (in this case it shows <em>crystalquick_sw</em>).</p>
</p>
<p>How do you select the default value, with javascript ? Maybe the problem comes from the call of this function which</p>
<p>is not good when there is an ajax request to build the select list ?&#160;</p>
<p>If you want I can do some debug on my side, just give me details of where is the code which select the default</p>
<p>value in a select edit form.</p>
<p>Again thanks a lot to look at my problem, and congratulations to your library : it is awesome !!!</p>
</p>
<p>Gael</p>
]]></description>
        	        	<pubDate>Fri, 25 Jun 2010 10:24:57 +0300</pubDate>
        </item>
        <item>
        	<title>tony on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18175</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18175</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>It is not a bug I think, but a way that Safari and Chrome works.</p>
<p>Also could you please post the <strong>exact code</strong> which you retrieve from server to build the select.</p>
<p>What you try to do first - add or edit or there is no difference?</p>
</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 25 Jun 2010 09:56:50 +0300</pubDate>
        </item>
        <item>
        	<title>gseroul on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18121</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18121</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>Thank you for your reply but I may gave a bad explanation of my problem because your answer is not helpfull for me.</p>
<p>My grid column show this value :&#160; "corning_192" (it is coming from the DB). When I edit the row the select list is created the firt time with an ajax request and it looks like in my previous post (just check above). But the default value in this select is the 1st value (&#60;option value=&#39;1&#39;&#62;crystalquick_rw&#60;/option&#62;  =&#62;  in FF and Opera) and white (nothing) in Safari. If I close the edit form and re-edit the same row (the select list is already created) then in the edit form the select list have the right default value =&#62; &#60;option value=&#39;4&#39;&#62;corning_192&#60;/option&#62;</p>
<p>And until I do not reload the page (then having the select list created) it is working for all rows in my grid. If I reload the page, the first time I edit the row we have the ajax request to get the select values from the DB and then again the 1st value is selected by default....</p>
</p>
<p>I tried to set the property recreateForm to true =&#62; then each time I edit a row the select list is getting from the server with ajax and then each time wrong default value.</p>
<p>It is like if the code to select the rigth value in the select list (the one showed in the edited row) is called before getting values from the server. Then the 1st time as there are no values in the list =&#62; no selected value (then default value is depended on browser), and after when this list already exist then the correct value is selected.</p>
</p>
<p>This is my colModelfor the select column</p>
<p><em>{name:&#39;platetype&#39;, width:150, sorttype:&#39;text&#39;, editable:true, edittype:"select", editoptions:{<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160; &#160; dataUrl:&#39;index.php?option=com_platesdetails&#38;task=getPlateTypeList&#39;</em></p>
<p><em>}},</em></p>
</p>
<p>and this is edit option :</p>
<p><em>var editOptions = {<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;saveicon:[false],<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;closeicon:[false],<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;width:400,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;height:210,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;modal:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;closeOnEscape:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;closeAfterEdit:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;reloadAfterSubmit:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;url: &#39;index.php?option=com_platesdetails&#38;task=updatePlate&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;checkOnSubmit:true,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;afterSubmit:updateStatus,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;bottominfo: &#39;Check the Plate Type !&#39;,<br />&#160;&#160; &#160;&#160;&#160; &#160;&#160;&#160; &#160;};</em></p>
<p>If someone have any idea or need more information feel free, this bug (if it is a bug and not something wrong with me <img class="spSmiley" style="margin:0" title="Laugh" src="/blog/wp-content/forum-smileys/sf-laugh.gif" alt="Laugh" />) is really annoying for my application and users.</p>
<p>Thanks to all</p>
<p>Gael</p>
]]></description>
        	        	<pubDate>Tue, 22 Jun 2010 10:07:07 +0300</pubDate>
        </item>
        <item>
        	<title>Renso on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18112</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18112</guid>
        	        	<description><![CDATA[<p>gseroul, you need to be careful with this grid, the value that you return and show in the grid&#39;s list needs to match the text value and not the option value.</p>
<p>For example I ahev a list of addresses listed and the first column is the type of address, work, home, etc:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit9471' value='Select Code' data-codeid='sfcode9471' /></p>
<div class='sfcode' id='sfcode9471'>&#60;td title=&#34;Work&#34; style=&#34;text-align: center;&#34;&#62;<strong>Work</strong>&#60;/td&#62;</div>
</p>
<p>BUT, the dropdown list looks like this:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5651' value='Select Code' data-codeid='sfcode5651' /></p>
<div class='sfcode' id='sfcode5651'>
<p>&#60;select id=&#34;TypeOfAddressDTO&#34; name=&#34;TypeOfAddressDTO&#34; size=&#34;1&#34; class=&#34;FormElement&#34;&#62;</p>
<p>&#60;option value=&#34;1&#34;&#62;<strong>Work</strong>&#60;/option&#62;</p>
<p>&#60;option value=&#34;2&#34;&#62;Mailing&#60;/option&#62;</p>
<p>&#60;option value=&#34;3&#34;&#62;Home&#60;/option&#62;</p>
<p>&#60;option value=&#34;9&#34;&#62;Other&#60;/option&#62;</p>
<p>&#60;option value=&#34;10&#34;&#62;Billing&#60;/option&#62;&#60;/select&#62;</p>
</div>
<p>I always thoght the value of the "Name" in colModel has to match the "key" or option value from the drop down list, but it is actually the text value it needs to match. Hope this helps. When the SAVE occurs it posts back the value (for WORK it will post back "1"). If you add a default first value to represent no specific option you can use</p>
<p><input type='button' class='sfcodeselect' name='sfselectit929' value='Select Code' data-codeid='sfcode929' /></p>
<div class='sfcode' id='sfcode929'>&#60;option value=&#34;&#34;&#62;All&#60;/option&#62;</div>
<p>, and when there is no value in the "name" column for that property it will select the first one ("All").</p></p>
]]></description>
        	        	<pubDate>Mon, 21 Jun 2010 22:37:38 +0300</pubDate>
        </item>
        <item>
        	<title>gseroul on FormEdit : select does not have the right default value</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18100</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/formedit-select-does-not-have-the-right-default-value#p18100</guid>
        	        	<description><![CDATA[<div id="post18007">
<p>Hi,</p>
<p>I use a grid and the edit form option. The  first time I edit a line in my form I have the GET request which ask  the server for the select values =&#62; the 1st value is selected by  default (and not the current row value). If I close the form and click  again on edit =&#62; no more Get as select values are kept in memory  (recreateForm false by default) and now the default value in the select  is OK, and this for all rows I want to edit.</p>
<p>If I set property recreateForm to true =&#62; I have a get on the  server to get select values each time =&#62; the select in the form have  always the 1st value in the list as default&#160; (which is wrong), even if I close  and edit again.</p>
<p>My conclusion (on my code here) is that each time there is a get for  select values on the server the default value is wrong (the 1st in the  list). Having this list in memory then all other edition will have  correct default value (mean the current value of the row).</p>
<p>On Safari the select have no default value =&#62; white, but closing  the form and re-editing is ok.</p>
<p>On Opera I have the 1st value by default each time, even if the list  is not recreated&#8230;.</p>
</p>
<p>Also my select is like this in the page source code (corning_192 =&#62; option 4,&#160; should be the default value, but 1 is selected) :</p>
<pre><div id="sfcode6475" class="sfcode">&#60;select&#62;<br />&#60;option value=&#39;1&#39;&#62;crystalquick_rw&#60;/option&#62;<br />&#60;option value=&#39;3&#39;&#62;corning_96&#60;/option&#62;</div><div id="sfcode9726" class="sfcode">&#60;option value=&#39;4&#39;&#62;corning_192&#60;/option&#62;<br />&#60;option value=&#39;6&#39;&#62;crystalquick_sw_new1&#60;/option&#62;<br />&#60;option value=&#39;7&#39;&#62;crystalquick_sw_new2&#60;/option&#62;<br />&#60;/select&#62;<br /><br /></div>Does anybody have an idea about this problem ?  I saw few people having problem with default select value.<br />As it is working well when the list is already created I tried to play with dataInit in editoptions of the corresponding field to close the<br />form and recall it jus after (then the list is created at the 1st call, the form is closed and reopen with the correct default value).<br />It is a bit dirty  <img class="spSmiley" style="margin:0" title="Laugh" src="/blog/wp-content/forum-smileys/sf-laugh.gif" alt="Laugh" /><br /><br />Gael<br /><br /><br /></pre>
</div>
]]></description>
        	        	<pubDate>Mon, 21 Jun 2010 12:07:53 +0300</pubDate>
        </item>
</channel>
</rss>