<?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 - Value not added to postdata sent to server</title>
	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server</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-value-not-added-to-postdata-sent-to-server/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>Basdub on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12190</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12190</guid>
        	        	<description><![CDATA[<p>Good explanation Mark, thank you!</p>
<p>I guess yes in one scenario, one could wrap everything inside it&#39;s own span.</p>
</p>
<p>Good for me! I&#39;ll take that!</p>
</p>
<p>Thanks again</p>
<p>Regards,</p></p>
]]></description>
        	        	<pubDate>Thu, 19 Nov 2009 09:31:30 +0200</pubDate>
        </item>
        <item>
        	<title>markw65 on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12189</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12189</guid>
        	        	<description><![CDATA[<p>Hi Tony,</p>
</p>
<p>I think you have a typo in your fix:</p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4061' value='Select Code' data-codeid='sfcode4061' /></p>
<div class='sfcode' id='sfcode4061'>var&#160;nm&#160;=&#160;elem.name,&#160;elem&#160;=&#160;celm[0];</div>
<p>you need to set elem, before name. Also, having set elem, you could use it, rather than calling <br />$("#"+nm,"#"+frmtb) again (or drop elem altogether, and use nm=celm[0].name).</p>
<p>On basdub&#39;s idea for multiple inputs - I&#39;m missing the point. Each customelement is associated with a single cell in the grid, so why would you want to post multiple values to the server?</p>
<p>I can see how you could want eg a datepicker and timepicker for a cell that contained a date-time. But you can do that anyway - and its still only a single value going to the server.</p>
<p>More generally, you /receive/ the data for the cell as a single item, why not post it back the same way? And if you do need multiple values, you can use json encoding (or any other encoding you like) to pack them into the one field...</p>
</p>
<p>And finally (!) I think the custom_value function should be passed the same element that custom_element created (as it does now) - if it wants multiple inputs wrapped in a span, it can create its own span 🙂</p>
</p>
<p>Mark</p>
]]></description>
        	        	<pubDate>Thu, 19 Nov 2009 09:24:21 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12188</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12188</guid>
        	        	<description><![CDATA[<p>Ok, how can i say this again: I AGREE WITH BOTH OF YOU!!!!</p>
</p>
<p>I&#39;m just saying that the provided solution could be made EVEN MORE FLEXIBLE, as stated in POST 4 and in POST 6,&#160; by setting the customelement class on the SPAN element and send the ENTIRE SPAN to custom_value function.</p>
</p>
<p>That way someone could even make ajax call to create MORE THAN ONE INPUT, SELECT, &#8230; element inside one custom_element. For example, someone could have another jGrid with mutiselect enabled as a custom element.</p>
]]></description>
        	        	<pubDate>Thu, 19 Nov 2009 08:20:38 +0200</pubDate>
        </item>
        <item>
        	<title>tony on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12164</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12164</guid>
        	        	<description><![CDATA[<p>Basdub,</p>
<p>I think that Mark is right. We should not be limited to input elements only, but to have a freedom to put what we want (this is the primary goal of the custom elements - otherwiese you can use the standart input and do evrething what you want with him)</p>
<p>I have put the fix provided from Mark and tested it and it seems to work. Beside from this there was another copy paste problem <img class="spSmiley" style="margin:0" title="Smile" src="/blog/wp-content/forum-smileys/sf-smile.gif" alt="Smile" /></p>
<p>The fix is in GitHub. Will be happy if it will work for you too.</p>
<p>Best Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Thu, 19 Nov 2009 04:39:17 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12143</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12143</guid>
        	        	<description><![CDATA[<p>Mark, that was just a quick fix. I totally agree with you on the fact that the custom element could be whatever we want, even further, it could be more than one control. See post 4!</p>
<p>I said in the post 4 that i would recommend to simply put the ".customelement" class flag on the &#60;span&#62; tag that surrounds the custom control.</p>
</p>
<p>Maybe the span should be sent to the custom_value on a "get". Then, you can work with whatever is inside that span and return the appropriate value.</p>
</p>
<p>All in all, that was a good catch from you. The "input" is way to much strict.</p>
</p>
<p>Regards,</p>
]]></description>
        	        	<pubDate>Wed, 18 Nov 2009 16:10:57 +0200</pubDate>
        </item>
        <item>
        	<title>markw65 on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12141</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12141</guid>
        	        	<description><![CDATA[<blockquote>
<p>Basdub said:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5548' value='Select Code' data-codeid='sfcode5548' /></p>
<div class='sfcode' id='sfcode5548'>if($(this)[0].tagName === &#39;SPAN&#39; &#38;&#38; $(this).children(&#8221;input&#8221;).hasClass(&#8221;customelement&#8221;)) {<br />&#160;&#160;&#160;&#160;&#160; var nm = $(this).children(&#8221;input&#8221;)[0].name, elem = $(this).children(&#8221;input&#8221;)[0];</div>
</blockquote>
<p>But why does a customelement have to be an input? Why couldnt I use a textarea, or a select, or something of my own devising (eg, a fixed datepicker, not associated with an input).</p>
</p>
<p>Shouldnt it be something like:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit8029' value='Select Code' data-codeid='sfcode8029' /></p>
<div class='sfcode' id='sfcode8029'>
<p>var celm = $(".customelement", this);</p>
<p>if (celm.length) {</p>
<p>&#160;&#160; var elem = celm[0], nm = elem.name;</p>
<p>&#160;&#160; ...</p>
<p>}</p>
</div>
<p>Mark</p>
]]></description>
        	        	<pubDate>Wed, 18 Nov 2009 15:33:15 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12139</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12139</guid>
        	        	<description><![CDATA[</p>
<p>If someone wants to have a custom element with multiple input or whatever, this might not work properly.&#160; I would recommend setting the customelement class "flag" on the span element.</p>
<p>This could eventually allow the custom element to send an additional set of itemSSS that could extend the current postdata</p>
</p>
<p>So instead of having</p>
<p><input type='button' class='sfcodeselect' name='sfselectit1408' value='Select Code' data-codeid='sfcode1408' /></p>
<div class='sfcode' id='sfcode1408'>postdata[nm] = this.editoptions.custom_value($("#"+nm,"#"+frmtb),&#39;get&#39;);</div>
<p>We could have</p>
<p><input type='button' class='sfcodeselect' name='sfselectit3461' value='Select Code' data-codeid='sfcode3461' /></p>
<div class='sfcode' id='sfcode3461'>p = this.editoptions.custom_value($("#"+nm,"#"+frmtb),&#39;get&#39;);<br /> $.extend(true,{},postdata,p);</div>
</p>
<p>Just a thought<img class="spSmiley" style="margin:0" title="Wink" src="/blog/wp-content/forum-smileys/sf-wink.gif" alt="Wink" /></p>
]]></description>
        	        	<pubDate>Wed, 18 Nov 2009 14:20:19 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12137</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12137</guid>
        	        	<description><![CDATA[</p>
<p>Ok, i got it to work. Assuming we want to keep the span surrounding the customelement.... which i think is good!</p>
</p>
<p>In grid.formedit.js around line 543</p>
<p><strong>Replace</strong></p>
<p><input type='button' class='sfcodeselect' name='sfselectit9601' value='Select Code' data-codeid='sfcode9601' /></p>
<div class='sfcode' id='sfcode9601'>if($(this).hasClass("customelement")) {<br />&#160;&#160;&#160;&#160; var nm = this.name, elem = this;</div>
<p><strong>With</strong></p>
</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5211' value='Select Code' data-codeid='sfcode5211' /></p>
<div class='sfcode' id='sfcode5211'>if($(this)[0].tagName === &#39;SPAN&#39; &#38;&#38; $(this).children("input").hasClass("customelement")) {<br />&#160;&#160;&#160;&#160;&#160; var nm = $(this).children("input")[0].name, elem = $(this).children("input")[0];</div>
</p>
<p>Also, in the same area of the code inside the "try" there&#39;s an undefined cm. Replacing "cm" with "this" fix the issue.</p>
<p>All of this might need to be applied in the grid.inline.js too.</p>
</p>
<p>If I have time, I might send Tony a push request for this.</p>
]]></description>
        	        	<pubDate>Wed, 18 Nov 2009 14:10:28 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12129</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12129</guid>
        	        	<description><![CDATA[<p>That&#39;s not a good fix.</p>
<p>Maybe the "customelement" class should be set on the span element</p>
]]></description>
        	        	<pubDate>Wed, 18 Nov 2009 09:40:21 +0200</pubDate>
        </item>
        <item>
        	<title>Basdub on Custom Input: Form Editing - Value not added to postdata sent to server</title>
        	<link>http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12128</link>
        	<category>Bugs</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/bugs/custom-input-form-editing-value-not-added-to-postdata-sent-to-server#p12128</guid>
        	        	<description><![CDATA[<p>Tony,</p>
</p>
<p>Just to have this as a seperate topic. The value from the custom input field is not sent to the server. The fix is very easy and might apply also for inline editing.</p>
</p>
<p>In file grid.formedit.js around line 543. you will find the following:</p>
<p><input type='button' class='sfcodeselect' name='sfselectit4692' value='Select Code' data-codeid='sfcode4692' /></p>
<div class='sfcode' id='sfcode4692'>if($(this).hasClass(&#8221;customelement&#8221;))</div>
</p>
<p>In that situation, $(this) is in fact the container of the input element =&#62; &#60;span class=&#8221;FormElement&#8221;&#62;&#60;input&#8230;</p>
<p>Therefore it will never have the class customElement.</p>
</p>
<p>Solution:</p>
<p>Change</p>
<p><input type='button' class='sfcodeselect' name='sfselectit5615' value='Select Code' data-codeid='sfcode5615' /></p>
<div class='sfcode' id='sfcode5615'>$(this)</div>
<p>to</p>
<p><input type='button' class='sfcodeselect' name='sfselectit7502' value='Select Code' data-codeid='sfcode7502' /></p>
<div class='sfcode' id='sfcode7502'>$(this).children(&#8221;input&#8221;)[0]</div>
</p>
<p>PS: There might be a better way to get the child control. Would like to learn it!</p>
]]></description>
        	        	<pubDate>Wed, 18 Nov 2009 09:34:57 +0200</pubDate>
        </item>
</channel>
</rss>