PDA

View Full Version : Seeking an inline edit script that saves data



uppercanuck
07-09-2009, 03:21 PM
I've found a number of inline editing scripts but none of them saves the data when you refresh the page. Does anyone know where I could find a script that allows users to modify one line of text on a page but that modified data is saved when the user refreshes or returns to the page? I can't seem to find anything that does this. I'd prefer a solution that uses jQuery or standalone JS.

Thank you!

Jesdisciple
07-09-2009, 04:49 PM
Do you have any server-side scripting languages available? I'll assume PHP for now. Ask questions!
On the page, put the line of text in an <input type="text> and put the element in a form.
Make a PHP script which saves your one line of text.
Set the page itself as the form's action, and when the form is submitted call the above script.
When the page loads, use JavaScript to:
Preserve the input element and replace it with a <span>.
Set an onclick listener on the span which replaces the span with the input element.
Set an onsubmit listener on the form which uses AJAX to call the PHP script, replace the input with the span, and return false.

uppercanuck
07-09-2009, 05:46 PM
That's what I was thinking but was hoping there'd be an open source bundle out there rather than try to do it from scratch. Time constraints and what not. If I come up with anything concrete, I'll post my findings. Thanks for your quick response. Love this board!

Cheers ;)