<?xml version="1.0" encoding="UTF-8"?><rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
> <channel><title>Comments on: Editable Content Using MooTools 1.2, PHP, and&#160;MySQL</title> <atom:link href="http://davidwalsh.name/editable-content-mootools-php-mysql/feed" rel="self" type="application/rss+xml" /><link>http://davidwalsh.name/editable-content-mootools-php-mysql</link> <description>PHP, CSS, MooTools, jQuery, and Everything Else</description> <lastBuildDate>Thu, 11 Mar 2010 12:44:18 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.9.2</generator> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>By: Barker Design &#124; Graphic &#38; Web Development &#187; Blog Archive &#187; Simple PHP Caching and Content Retrieval&#160;Function</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-14438</link> <dc:creator>Barker Design &#124; Graphic &#38; Web Development &#187; Blog Archive &#187; Simple PHP Caching and Content Retrieval&#160;Function</dc:creator> <pubDate>Fri, 11 Dec 2009 09:06:03 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-14438</guid> <description>[...] Editable Content Using MooTools 1.2, PHP, and&#160;MySQL [...]</description> <content:encoded><![CDATA[<p>[...] Editable Content Using MooTools 1.2, PHP, and&nbsp;MySQL [...]</p> ]]></content:encoded> </item> <item><title>By: Simple PHP Caching and Content Retrieval&#160;Function &#124; Programming Blog</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-14424</link> <dc:creator>Simple PHP Caching and Content Retrieval&#160;Function &#124; Programming Blog</dc:creator> <pubDate>Thu, 10 Dec 2009 20:40:08 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-14424</guid> <description>[...] Editable Content Using MooTools 1.2, PHP, and&#160;MySQL [...]</description> <content:encoded><![CDATA[<p>[...] Editable Content Using MooTools 1.2, PHP, and&nbsp;MySQL [...]</p> ]]></content:encoded> </item> <item><title>By: Hadrien</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-13027</link> <dc:creator>Hadrien</dc:creator> <pubDate>Wed, 28 Oct 2009 18:27:53 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-13027</guid> <description>@Hadrien:Found !
I don&#039;t know how but it works well now :) I have also put a check if leaving with empty value//once the dom is ready
window.addEvent(&#039;domready&#039;, function() {
//find the editable$$(&#039;.editable&#039;).each(function(el) {//add double-click and blur events
el.addEvent(&#039;dblclick&#039;,function() {
el.removeClass(&#039;editable&#039;);
//store &quot;before&quot; message
var before = el.get(&#039;text&#039;).trim();
var before2 = el.get(&#039;id&#039;).trim();
//erase current
el.set(&#039;html&#039;,&#039;&#039;);
//replace current text/content with input or textarea element
if(el.hasClass(&#039;textarea&#039;))
{
var input = new Element(&#039;textarea&#039;, { &#039;class&#039;:&#039;box&#039;, &#039;text&#039;:before });
}
else
{
var input = new Element(&#039;input&#039;, { &#039;class&#039;:&#039;box&#039;, &#039;value&#039;:before });
//blur input when they press &quot;Enter&quot;
input.addEvent(&#039;keydown&#039;, function(e) { if(e.key == &#039;enter&#039;) { this.fireEvent(&#039;blur&#039;); } });
}
input.inject(el).select();
//add blur event to input
input.addEvent(&#039;blur&#039;, function() {
//get value, place it in original element
val = input.get(&#039;value&#039;).trim();var iWhere = val.indexOf(&#039; -1) {
el.set(&#039;text&#039;,before);
} else {
if(val==&#039;&#039;) {
el.set(&#039;text&#039;,before2);
} else {
el.set(&#039;text&#039;,val);
}
}
//save respective record
var url = &#039;ajax/saveCompetence.php?id=&#039; + el.get(&#039;rel&#039;) + &#039;&amp;content=&#039; + el.get(&#039;text&#039;);
var request = new Request({
url:url,
method:&#039;post&#039;
}).send();
});
});
});
});</description> <content:encoded><![CDATA[<p>@Hadrien:</p><p>Found !<br
/> I don&#8217;t know how but it works well now :) I have also put a check if leaving with empty value</p><p>//once the dom is ready<br
/> window.addEvent(&#8216;domready&#8217;, function() {<br
/> //find the editable</p><p> $$(&#8216;.editable&#8217;).each(function(el) {</p><p> //add double-click and blur events<br
/> el.addEvent(&#8216;dblclick&#8217;,function() {<br
/> el.removeClass(&#8216;editable&#8217;);</p><p> //store &#8220;before&#8221; message<br
/> var before = el.get(&#8216;text&#8217;).trim();<br
/> var before2 = el.get(&#8216;id&#8217;).trim();<br
/> //erase current<br
/> el.set(&#8216;html&#8217;,&#8221;);<br
/> //replace current text/content with input or textarea element<br
/> if(el.hasClass(&#8216;textarea&#8217;))<br
/> {<br
/> var input = new Element(&#8216;textarea&#8217;, { &#8216;class&#8217;:'box&#8217;, &#8216;text&#8217;:before });<br
/> }<br
/> else<br
/> {<br
/> var input = new Element(&#8216;input&#8217;, { &#8216;class&#8217;:'box&#8217;, &#8216;value&#8217;:before });<br
/> //blur input when they press &#8220;Enter&#8221;<br
/> input.addEvent(&#8216;keydown&#8217;, function(e) { if(e.key == &#8216;enter&#8217;) { this.fireEvent(&#8216;blur&#8217;); } });<br
/> }<br
/> input.inject(el).select();<br
/> //add blur event to input<br
/> input.addEvent(&#8216;blur&#8217;, function() {<br
/> //get value, place it in original element<br
/> val = input.get(&#8216;value&#8217;).trim();</p><p> var iWhere = val.indexOf(&#8216; -1) {<br
/> el.set(&#8216;text&#8217;,before);<br
/> } else {<br
/> if(val==&#8221;) {<br
/> el.set(&#8216;text&#8217;,before2);<br
/> } else {<br
/> el.set(&#8216;text&#8217;,val);<br
/> }<br
/> }</p><p> //save respective record<br
/> var url = &#8216;ajax/saveCompetence.php?id=&#8217; + el.get(&#8216;rel&#8217;) + &#8216;&amp;content=&#8217; + el.get(&#8216;text&#8217;);<br
/> var request = new Request({<br
/> url:url,<br
/> method:&#8217;post&#8217;<br
/> }).send();<br
/> });<br
/> });<br
/> });<br
/> });</p> ]]></content:encoded> </item> <item><title>By: Hadrien</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-13021</link> <dc:creator>Hadrien</dc:creator> <pubDate>Wed, 28 Oct 2009 16:39:58 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-13021</guid> <description>HelloThis script&#039;s very good and it is exactely what I was searching, thanks for this blog David, it has already helped me several time :)
But I have a problem with this script, when you dblclick twice it &quot;edit&quot; the input box and write :If anyone know this issue, please tell me :)</description> <content:encoded><![CDATA[<p>Hello</p><p>This script&#8217;s very good and it is exactely what I was searching, thanks for this blog David, it has already helped me several time :)<br
/> But I have a problem with this script, when you dblclick twice it &#8220;edit&#8221; the input box and write :</p><p>If anyone know this issue, please tell me :)</p> ]]></content:encoded> </item> <item><title>By: Barker Design &#124; Graphic &#38; Web Development &#187; Blog Archive &#187; Save Web Form Content Using Control + S</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-12739</link> <dc:creator>Barker Design &#124; Graphic &#38; Web Development &#187; Blog Archive &#187; Save Web Form Content Using Control + S</dc:creator> <pubDate>Sun, 18 Oct 2009 14:10:13 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-12739</guid> <description>[...] Editable Content Using MooTools 1.2, PHP, and MySQL [...]</description> <content:encoded><![CDATA[<p>[...] Editable Content Using MooTools 1.2, PHP, and MySQL [...]</p> ]]></content:encoded> </item> <item><title>By: Save Web Form Content Using Control + S &#124; Programming Blog</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-12653</link> <dc:creator>Save Web Form Content Using Control + S &#124; Programming Blog</dc:creator> <pubDate>Wed, 14 Oct 2009 15:43:10 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-12653</guid> <description>[...] Editable Content Using MooTools 1.2, PHP, and MySQL [...]</description> <content:encoded><![CDATA[<p>[...] Editable Content Using MooTools 1.2, PHP, and MySQL [...]</p> ]]></content:encoded> </item> <item><title>By: vrS</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-12197</link> <dc:creator>vrS</dc:creator> <pubDate>Sun, 27 Sep 2009 01:59:42 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-12197</guid> <description>The complete code, taking the previous enrico&#039;s solution is the followingif(el.get(&#039;text&#039;)!=before){
.....AJAX CALL
}
else{
el.addClass(&#039;editable&#039;)
}my english sucks, i know :(</description> <content:encoded><![CDATA[<p>The complete code, taking the previous enrico&#8217;s solution is the following</p><p>if(el.get(&#8216;text&#8217;)!=before){<br
/> &#8230;..AJAX CALL<br
/> }<br
/> else{<br
/> el.addClass(&#8216;editable&#8217;)<br
/> }</p><p>my english sucks, i know :(</p> ]]></content:encoded> </item> <item><title>By: vrS</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-12196</link> <dc:creator>vrS</dc:creator> <pubDate>Sun, 27 Sep 2009 00:25:59 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-12196</guid> <description>Excellent!
I just add this before the  Ajax Call
[code]
if(el.get(&#039;text&#039;)!=before)
[/code]</description> <content:encoded><![CDATA[<p>Excellent!<br
/> I just add this before the  Ajax Call<br
/> [code]<br
/> if(el.get('text')!=before)<br
/> [/code]</p> ]]></content:encoded> </item> <item><title>By: Angra-Mainyu</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-9523</link> <dc:creator>Angra-Mainyu</dc:creator> <pubDate>Sun, 31 May 2009 16:12:56 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-9523</guid> <description>Hi all.
Great works.
I&#039;m working hard on my new project, and i can do good things with your help ^^.
With your code, i have implemented an inline edit system with nicEdit.Here is the code ://once the dom is readywindow.addEvent(&#039;domready&#039;, function() {//find the editable areas
$$(&#039;.editable&#039;).each(function(el) {
//add double-click and blur events
el.addEvent(&#039;dblclick&#039;,function() {
el.removeClass(&#039;editable&#039;);
//store &quot;before&quot; message
var before = el.get(&#039;html&#039;).trim();
//erase current
el.set(&#039;html&#039;,&#039;&#039;);var input = new Element(&#039;textarea&#039;, { &#039;class&#039;:&#039;box&#039;, &#039;text&#039;:before });
input.inject(el).select();
/* create a nicEdit instance in the input element ( must have nicEdit.js loaded befor ) */
var editor =  new nicEditor().panelInstance(input);var input2 = new Element(&#039;button&#039;, { &#039;class&#039;:&#039;button&#039;, &#039;text&#039;:&#039;Save&#039; });
input2.inject(el);
input2.addEvent(&#039;click&#039;, function() {
//get value, place it in original element
e = nicEditors.findEditor(input);
if(e) {
/* get the content of the editor */
var content = e.getContent();
//e.removePanel();
el.set(&#039;html&#039;,content).addClass(content != &#039;&#039; ? &#039;&#039; : &#039;editable-empty&#039;);var req = new Request({
url:document.location.href,
onSuccess : function(response) {
var roar = new Roar();
roar.alert(&#039;my personal response&#039;,response);
el.addClass(’editable’);
},
onFailure: function() {
el.addClass(’editable’);
}
}).post({divContent:content,id:el.get(&#039;rel&#039;)});
}
});
});
});});And it works fine for me.
Great thanks. ( forgive my poor english ^^&#039; )</description> <content:encoded><![CDATA[<p>Hi all.<br
/> Great works.<br
/> I&#8217;m working hard on my new project, and i can do good things with your help ^^.<br
/> With your code, i have implemented an inline edit system with nicEdit.</p><p>Here is the code :</p><p>//once the dom is ready</p><p>window.addEvent(&#8216;domready&#8217;, function() {</p><p>//find the editable areas<br
/> $$(&#8216;.editable&#8217;).each(function(el) {<br
/> //add double-click and blur events<br
/> el.addEvent(&#8216;dblclick&#8217;,function() {<br
/> el.removeClass(&#8216;editable&#8217;);<br
/> //store &#8220;before&#8221; message<br
/> var before = el.get(&#8216;html&#8217;).trim();<br
/> //erase current<br
/> el.set(&#8216;html&#8217;,&#8221;);</p><p> var input = new Element(&#8216;textarea&#8217;, { &#8216;class&#8217;:'box&#8217;, &#8216;text&#8217;:before });<br
/> input.inject(el).select();<br
/> /* create a nicEdit instance in the input element ( must have nicEdit.js loaded befor ) */<br
/> var editor =  new nicEditor().panelInstance(input);</p><p> var input2 = new Element(&#8216;button&#8217;, { &#8216;class&#8217;:'button&#8217;, &#8216;text&#8217;:'Save&#8217; });<br
/> input2.inject(el);<br
/> input2.addEvent(&#8216;click&#8217;, function() {<br
/> //get value, place it in original element<br
/> e = nicEditors.findEditor(input);<br
/> if(e) {<br
/> /* get the content of the editor */<br
/> var content = e.getContent();<br
/> //e.removePanel();<br
/> el.set(&#8216;html&#8217;,content).addClass(content != &#8221; ? &#8221; : &#8216;editable-empty&#8217;);</p><p> var req = new Request({<br
/> url:document.location.href,<br
/> onSuccess : function(response) {<br
/> var roar = new Roar();<br
/> roar.alert(&#8216;my personal response&#8217;,response);<br
/> el.addClass(’editable’);<br
/> },<br
/> onFailure: function() {<br
/> el.addClass(’editable’);<br
/> }<br
/> }).post({divContent:content,id:el.get(&#8216;rel&#8217;)});<br
/> }<br
/> });<br
/> });<br
/> });</p><p>});</p><p>And it works fine for me.<br
/> Great thanks. ( forgive my poor english ^^&#8217; )</p> ]]></content:encoded> </item> <item><title>By: dude</title><link>http://davidwalsh.name/editable-content-mootools-php-mysql/comment-page-2#comment-7411</link> <dc:creator>dude</dc:creator> <pubDate>Thu, 22 Jan 2009 02:21:33 +0000</pubDate> <guid
isPermaLink="false">http://davidwalsh.name/?p=309#comment-7411</guid> <description>@ryan: No apologies needed. I used the ID attribute and made it valid.  I added a letter in the while loop before the item&#039;s ID then stripped it out with PHP before updating the DB. </description> <content:encoded><![CDATA[<p>@ryan: No apologies needed. I used the ID attribute and made it valid.  I added a letter in the while loop before the item&#8217;s ID then stripped it out with PHP before updating the DB.</p> ]]></content:encoded> </item> </channel> </rss>
<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Page Caching using disk (enhanced) (user agent is rejected)
Database Caching 4/19 queries in 0.026 seconds using disk

Served from: davidwalsh.name @ 2010-03-11 12:54:04 -->