WebDevDanno
WebDevDanno

Reputation: 1122

Make paragraph of text an editable textarea on click

I have an about box on a profile page I'm working on (see below). Now that area shown by the textarea will have a PHP variable (about user column) produced in the space.

enter image description here

What I want to do is when a user clicks edit the paragraph content produced becomes an editable <textarea> which I can then save and it will write the new data to my PostGreSQL database and instantly show the new edit.

Basically I'm looking for a dynamically editable paragraph/textarea combo which will automatically update the database storing the original textual data in an about user column.

I have researched many JQuery examples like this on jsfiddle - http://jsfiddle.net/BenjaminRH/467S5/ but that doesn't have the database functionality I am looking for.

Upvotes: 0

Views: 669

Answers (1)

Grant Thomas
Grant Thomas

Reputation: 45058

In essence, the HTML5 ContentEditable attribute could be perfect here.

This won't automatically update any databases, or anything for that matter, but nor will any other control that isn't some kind of composite made specifically for (and even genericised to handle) certain database types and scenarios and frameworks etc.

Therefore, in order to get this (a control that does it all) you're likely going to need to hunt down a third party product - there may be a free one (I've not seen one for the likes of PHP or ASP.NET or other major frameworks, and frankly I'm glad), or you may be stuck with having to buy one. As expected, I personally can't vouch for any, and wouldn't recommend such a plug n' play control anyway.

But, as per my first suggestion, there's half the task done - just write the code-behind in a reusable class and hook it up some how.

Upvotes: 1

Related Questions