leon_nerd Posted June 14, 2008 Share Posted June 14, 2008 Hi Guys, I am currently working on a php based web application. I am kinda new to this. I want to implement something like "click to edit title" for picture in my website. This is one of those things where u can simply click the text and it becomes editable and as soon as the focus is taken off that block it is saved. Now the later part of saving on blur is clear to me. But the problem is how to achieve this "click to edit title" effect? You can see such kind of effects on many web 2.0 websites. I tried googling but seems like I was not looking using the right terminology. So any help in this regard will be highly appreciated. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/110205-how-to-click-to-edit/ Share on other sites More sharing options...
hansford Posted June 14, 2008 Share Posted June 14, 2008 this is going to be a javascript function. http://tool-man.org/examples/edit-in-place.html Quote Link to comment https://forums.phpfreaks.com/topic/110205-how-to-click-to-edit/#findComment-565578 Share on other sites More sharing options...
haku Posted June 17, 2008 Share Posted June 17, 2008 This is called AJAX (Asynchronus JAvascript and Xml). AJAX is always done with javascript, and usually combined with a server side language. And often, that server-side language returns XML. In the situation of which you are speaking, you would make it so that javascript 'listens' for the edit link to be clicked. When it is clicked, it reads all the text to be edited, and removes the element (most likely a p tag) from the page, replacing it with an input of type text, and then inserts the text it read into this input. Next, when the user clicks finished or submit, javascript then reads in the new text, and passes that text to a script on the server in the background. The script on the server then inserts it into the database, and passes back something to tell the javascript whether it successfully entered the data into the database or not. If it was successfully entered, the text input is then changed back to a new element (again, most likely a p tag) and the text is inserted into it. Thats the theory behind it. Quote Link to comment https://forums.phpfreaks.com/topic/110205-how-to-click-to-edit/#findComment-567084 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.