<?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: Edit Form Text Area New Line</title>
	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line</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/help/edit-form-text-area-new-line/rss" rel="self" type="application/rss+xml" />
        <item>
        	<title>phazzy on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p16717</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p16717</guid>
        	        	<description><![CDATA[<p>Thanks for the solution!</p>
<p>I was replacing "\n" with &#38;#10 after getting data from the server, and it was working perfectly in Firefox even when editing with textarea. But because of the JQuery .html() function behavior it was not working in IE at all. Your solution solved it 🙂</p>
]]></description>
        	        	<pubDate>Mon, 26 Apr 2010 17:20:47 +0300</pubDate>
        </item>
        <item>
        	<title>JaySab on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7572</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7572</guid>
        	        	<description><![CDATA[<p>ok ...</p>
<p>I&#39;ve solved my final problem by editing grid.inlinedit.js.&#160; After line 94:</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;tmp[nm]= !$t.p.autoencode ? $("input, textarea",this).val() : htmlEncode($("input, textarea",this).val());</p>
<p>I&#39;ve added:</p>
<p>tmp[nm]=tmp[nm].replace(/\\n/g,&#39;&#60;BR&#62;&#39;);</p>
<p>This replaces the javascript \\n line breaks with a &#60;BR&#62; and allow line breaks to show correctly in cells when they are not being edited.</p>
]]></description>
        	        	<pubDate>Wed, 01 Jul 2009 04:26:16 +0300</pubDate>
        </item>
        <item>
        	<title>JaySab on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7549</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7549</guid>
        	        	<description><![CDATA[<p>Right, I am getting somewhere with this problem now but am stuck again, so I&#39;m hoping some kind soul could offer some advice.</p>
</p>
<p>In my function which returns (JSON format) data from the server, I&#39;m doing a replace on CHR(10) and returning &#60;BR&#62; instead.&#160; This has the desired effect of breaking up my text in cells in the grid.&#160; Problem 1 solved.</p>
<p>In my call to editRow in my onSelectRow event, I&#39;m passing a function name to the oneditfunc parameter.&#160; In this function I&#39;m replacing &#60;BR&#62; with \\n.&#160; This has the desired effect of putting line breaks into my editable text area when the row is clicked.&#160; Problem 2 solved 🙂</p>
<p>My remaining problem is thus: when I edit a cell and put carriage returns in the text and hit return, the row is saved.&#160; Looking in my data, I can see that it has saved with a chr(10).&#160; So far so good.&#160; However, the grid doesn&#39;t refresh&#160;after a save, and the grid replaces any carriage returns with spaces.&#160; ie - in the GUI, it has now lost me my nice line breaks.&#160; So my question is - what is the best way to have the&#160;grid preserve these line breaks once they have been edited?</p>
<p>Thanks in advance.</p>
]]></description>
        	        	<pubDate>Tue, 30 Jun 2009 05:36:04 +0300</pubDate>
        </item>
        <item>
        	<title>JaySab on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7421</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7421</guid>
        	        	<description><![CDATA[<p>Maggie, I&#39;d be interested to know if you got anywhere with this as I&#160;am just starting to look at the same problem.&#160; I&#39;m using inline editing.&#160; So&#160; far I&#39;ve made a change to grid.inlinedit.js and allowed enter to be used in textareas without the row saving.&#160; But now I&#39;m getting the same line break problem.&#160; The data is saved correctly, ie - it preserves the line break, but I don&#39;t know how to output the lline break to the textarea when editing.</p>
]]></description>
        	        	<pubDate>Tue, 23 Jun 2009 10:42:16 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7201</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7201</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>It is really difficult to play with this, but maybe you will need to call ajax in beforeShowForm to obtain that field from db.</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Fri, 12 Jun 2009 02:36:04 +0300</pubDate>
        </item>
        <item>
        	<title>maggie on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7164</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7164</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>Anyone knows how to&#160;preserve&#160;line break in the form text area?</p>
<p>Thanks! Maggie</p>
]]></description>
        	        	<pubDate>Thu, 11 Jun 2009 09:13:34 +0300</pubDate>
        </item>
        <item>
        	<title>maggie on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7091</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7091</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>I figured out how to get the form field value. but I can&#39;t make the line break work. My codes are as below:</p>
<p>beforeShowForm : function(formid){</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //get comments (text area field) value;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;var comments= $("#comments",formid).val() ;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //replacement</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; var newComments = comments.replace(/\\n/g, "&#60;br/&#62;");</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; //set field with new value<br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;$("#comments",formid).val(newComments);</p>
<p>}<br />&#160;</p>
<p>&#160;For example, I want the field show in sevral lines:</p>
<p>firstline</p>
<p>secondline</p>
<p>thirdline</p>
<p>but it shows as firstline&#60;br/&#62; secondline&#60;br/&#62; thirdline</p>
<p>How to convert the &#60;br/&#62; to new lines?</p>
</p>
<p>I know I can use&#160; "<span style="font-size: x-small; color: #2a00ff;"><span style="font-size: x-small; color: #2a00ff;"><font size="2" color="#2a00ff"></font><font size="2" color="#2a00ff"></font></span></span></p>
<p>&#60;![CDATA[]]&#62;</p>
<p><font size="2" color="#2a00ff"></p>
<p></font></p>
<p>" for the grid cell value, but it does not work for the edit form field.</p>
</p>
<p>Thanks, Maggie</p>
]]></description>
        	        	<pubDate>Sat, 06 Jun 2009 07:59:18 +0300</pubDate>
        </item>
        <item>
        	<title>maggie on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7090</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7090</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>How to get the value of a field and do the change?</p>
<p align="left">&#160;</p>
<p align="left"><span style="font-size: x-small;">I tired this:</span></p>
<p><span style="font-size: x-small;"> beforeShowForm : function(formid){</span></p>
<p><span style="font-size: x-small;">&#160;&#160; alert ("field value: " + <span style="font-size: x-small;">$(</span><span style="font-size: x-small; color: #8e00ff;"><span style="font-size: x-small; color: #8e00ff;">"#Comments"</span></span><span style="font-size: x-small;">,formid).value</span>);</span></p>
<p><span style="font-size: x-small;">},</span></p>
<p><span style="font-size: x-small;">But it does not work.</span></p>
<p><span style="font-size: x-small;">Can you give me an example?</span></p>
<p>Thanks,</p>
<p>Maggie</p>
]]></description>
        	        	<pubDate>Fri, 05 Jun 2009 17:22:02 +0300</pubDate>
        </item>
        <item>
        	<title>tony on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7059</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7059</guid>
        	        	<description><![CDATA[<p>Hello,</p>
<p>onInitialize form fires only one time. Try with beforeShowForm for that textarea field</p>
<p>Regards</p>
<p>Tony</p>
]]></description>
        	        	<pubDate>Thu, 04 Jun 2009 05:25:53 +0300</pubDate>
        </item>
        <item>
        	<title>maggie on Edit Form Text Area New Line</title>
        	<link>http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7021</link>
        	<category>Help</category>
        	<guid isPermaLink="true">http://www.trirand.com/blog/?page_id=393/help/edit-form-text-area-new-line#p7021</guid>
        	        	<description><![CDATA[<p>Hi,</p>
<p>I have a column called "Comments ". &#160;I set it as "TEXTAREA" on the edit form. &#160;I can use "Enter" key to do a new line in the input box. And the new line "\\n"&#160; can be saved in the database.&#160; But when I open the edit form again, the line break disappear. How to show the line break in the text area input box again? I am thinking of doing something using onInitializeForm function: <span style="font-size: x-small;"><font size="2"></font></span></p>
<p align="left">onInitializeForm :</p>
</p>
<p align="left"><span style="font-size: x-small; color: #7f0055;"><span style="font-size: x-small; color: #7f0055;">function </span></span><span style="font-size: x-small;">(formid) </span><span style="font-size: x-small; color: #7f0055;"><span style="font-size: x-small; color: #7f0055;">{<font size="2" color="#7f0055"></font><font size="2" color="#7f0055"></font></span></span></p>
<p align="left">&#160;</p>
<p><font size="2" color="#7f0055"></font></p>
<p align="left">&#160;</p>
</p>
<p align="left"><span style="font-size: x-small;">&#160;&#160;&#160;&#160;&#160;&#160; //re</span><span style="font-size: x-small;">place "\\n" with the html code &#60;br/&#62;;</span></p>
<p align="left"><span style="font-size: x-small; color: #7f0055;"><span style="font-size: x-small; color: #7f0055;">}</span></span></p>
<p align="left"><span style="font-size: x-small; color: #7f0055;"><span style="font-size: x-small; color: #7f0055;">Is this doable? can you give me some example codes?</span></span></p>
<p align="left">&#160;</p>
<p align="left"><span style="font-size: x-small; color: #7f0055;">Thanks! </span></p>
<p align="left"><span style="font-size: x-small; color: #7f0055;">Maggie</span></p>
<p align="left"><span style="font-size: x-small; color: #7f0055;"></span></p>
]]></description>
        	        	<pubDate>Tue, 02 Jun 2009 18:32:46 +0300</pubDate>
        </item>
</channel>
</rss>