<?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: Custom Input: Form Editing el.val() always undefined</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined</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/custom-input-form-editing-elval-always-undefined/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>tony on Custom Input: Form Editing el.val() always undefined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12109</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12109</guid>
        	        	<description><![CDATA[<p>Mark, Basdub,</p>
<p>Thanks. I have made the needed fixes. Appart from this there was another bug in case when the value is empty -</p>
<p>I compare it like this</p>
<p><input type='button' class='sfcodeselect' name='sfselectit6707' value='Select Code' data-codeid='sfcode6707' /></p>
<div class='sfcode' id='sfcode6707'>
<p>tmp[nm] = cm.editoptions.custom_value($(".customelement",this));</p>
<p>if(!tmp[nm]) ....</p>
</div>
<p>which is wrong if the value is 0 or empty.</p>
<p>Also I will update the documentation in case of formediting</p>
<p>The changes are in GitHub.</p>
<p>Thanks again</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Wed, 18 Nov 2009 07:08:28 +0200</pubDate>
        </item>
        <item>
        	<title>markw65 on Custom Input: Form Editing el.val() always undefined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12102</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12102</guid>
        	        	<description><![CDATA[<p>Basically, the custom_value function has two purposes, one to get the value from the form, and post it to the server, and the other to put the value into the form.</p>
</p>
<p>Rather than two functions, its a single function, and the second parameter is either "set" or "get" to control which operation it performs.</p>
</p>
<p>But basically "get" is your custom_value, and "set" is your custom_format.</p>
</p>
<p>The problem is that the call to "set" from fillData is broken, and cant possibly work (again, assuming Im not just confused). So right now, to use a custom element you have to use { recreateForm:true }.</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 23:26:56 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing el.val() always undefined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12100</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12100</guid>
        	        	<description><![CDATA[<p>Sounds great when you say:</p>
<p>&#8220;</p>
<p>So, in other words, apart from the naming convention (and the bug!), everything is supposed to work the way we both want anyway&#8230;</p>
<p>&#8220;</p>
</p>
<p>Unfortunately, it is late and I&#39;m not sure I understand your explanation on how custom_element and custom_value are called and used.</p>
<p>I&#39;ll read again tomorrow <img class="wp-smiley" src="/blog/wp-includes/images/smilies/icon_wink.gif" alt=";-)" /></p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 22:09:54 +0200</pubDate>
        </item>
        <item>
        	<title>markw65 on Custom Input: Form Editing el.val() always undefined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12096</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12096</guid>
        	        	<description><![CDATA[<p>So it looks like the custom element has changed since the documentation was written:</p>
</p>
<p>custom_element.custom_value(jQuery-element, "get") returns the value of the custom element that should be posted to the server.</p>
</p>
<p>And it appears that the corresponding "set" is supposed to set the value in the form... but unless Im very confused its completely broken...</p>
<p>At line 766 of grid.formedit.js we have:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7715' value='Select Code' data-codeid='sfcode7715' /></p>
<div class='sfcode' id='sfcode7715'>var dummy = cm[i].editoptions.custom_value($(".customelement",this),&#39;set&#39;);</div>
</p>
<p>Problem is that "this" is actually the corresponding "td" cell - which probably doesnt /have/ a child with class "customelement".Even if it did, we wouldnt know which custom element we&#39;re supposed to be setting the value of (or, on the other hand, if "this" were the span containing the custom element, we wouldnt know what value to set it to!).</p>
</p>
<p>I think its supposed to be</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4988' value='Select Code' data-codeid='sfcode4988' /></p>
<div class='sfcode' id='sfcode4988'>var dummy = cm[i].editoptions.custom_value($("#"+nm,"#"+fmid),&#39;set&#39;,tmp);</div>
</p>
<p>Where tmp /is/ the unformatted value of the cell.</p>
</p>
<p>So, in other words, apart from the naming convention (and the bug!), everything is supposed to work the way we both want anyway...</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 18:16:54 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing el.val() always undefined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12093</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12093</guid>
        	        	<description><![CDATA[<p>To make things less confusing, lets redefined the 3 functions again:</p>
</p>
<p>custom_element: create the input element;</p>
<p>custom_format: format the data for the custom_element value</p>
<p>custom_value: unformat or else the custom_element value to be sent to the server</p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 16:46:03 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing el.val() always undefined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12091</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12091</guid>
        	        	<description><![CDATA[<p>Mark, the only reason that i want to add the *new* custom_value is in this situation (for example).</p>
</p>
<p>I have a field stored in numeric in my database that represent a duration in seconds. In the grid, I use the custom format and unformat to convert this value into &#8220;hh:mm:ss&#8221;.</p>
<p>Right now, when i create the form (the first time), i get the unformatted value for example &#8220;120&#8243; that i transform again to &#8220;00:02:00&#8243; (2 minutes) for my input field value. Then, after i created my input control, i can associate a time picker using, for example, $(&#60;input&#62;).timepicker().</p>
<p>If filldata doesn&#39;t recreate the input control, then the next time i open the edit form, I assume that i will see &#8220;120&#8243;.</p>
</p>
<p>Now with the new functions,</p>
<p>custom_value*: change &#8220;120&#8243; to &#8220;00:02:00&#8243; and if custom_value doesn&#39;t exist, it would simply display the unformatted value taken from $.fn.***.unformat</p>
<p>custom_postvalue: change back &#8220;00:02:01&#8243; to &#8220;121&#8243; to send back to the server.</p>
</p>
<p>Regards</p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 16:34:39 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing el.val() always undefined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12088</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12088</guid>
        	        	<description><![CDATA[<p>Thanks Mark,</p>
</p>
<p>Concerning the data that is not posted, I think i&#39;ve found the source of the problem:</p>
</p>
<p>In file grid.formedit.js around line 543. you will find the following:</p>
<p>if($(this).hasClass("customelement"))</p>
</p>
<p>In that situation, $(this) is in fact the container of the input element =&#62; &#60;span class="FormElement"&#62;&#60;input...</p>
<p>Therefore it will never have the class customElement.</p>
</p>
<p>Solution:</p>
<p>Change $(this) to $(this).children("input")[0]</p>
<p>Well, there might be a better way to get the the first child of the span element. I will be please to learn that!!!!</p>
</p>
<p>Regards,</p></p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 16:24:40 +0200</pubDate>
        </item>
        <item>
        	<title>markw65 on Custom Input: Form Editing el.val() always undefined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12087</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12087</guid>
        	        	<description><![CDATA[<p>I&#39;ll second this one.</p>
</p>
<p>fillData should use unformat to get the data, and the custom element should take /that/ string as its input when filling in the value on the edit form.</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 16:10:05 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing el.val() always undefined</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12084</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-elval-always-undefined#p12084</guid>
        	        	<description><![CDATA[<p>Might be related to  <strong> Inline Edit: Custom Input</strong></p>
</p>
<p>In the documentation (and don&#39;t take this the wrong way), it says that custom_element is used to create the input element for the form and custom_value is used to get the value to be sent to the server.</p>
<p>The question is: What is custom_value doing in fillData function?????????? I&#39;m bugging you don&#39;t take it the wrong way!!!</p>
</p>
<p>What i&#39;ve noticed so far:</p>
<ul style="padding-left: 30px;">
<li>When i click on the pencil icon, the form is displayed correctly without any problem.</li>
<li>When i click the Submit button, the custom_value is not called and therefore the value for that field is not sent to the server</li>
<li>When i reopen the edit form for the same or a different row, custom_value is called from the fillData function according to firebug... and the source code 🙂</li>
</ul>
<p>To solve this (this is my opinion only):</p>
<ul style="padding-left: 30px;">
<li>filldata should "always" use $.fn.***.unformat function to get the value from the grid</li>
<li>the custom input should be handled with 3 functions instead of 2
<ul>
<li>custom_element: create the lement</li>
<li>custom_value: format the value for the input field defined by custom_element</li>
<li>custom_postvalue: return the unformatted or else value from the custom_element that will be sent to the server.</li>
</ul>
</li>
</ul>
<p>Regards!!</p>
<p style="padding-left: 30px;">&#160;</p>
]]></description>
        	        	<pubDate>Tue, 17 Nov 2009 14:43:28 +0200</pubDate>
        </item>
</channel>
</rss>