I’m using Jeditable with jQuery and it is mostly working how I want it. When the user submits some changes via jeditable (I’m using a textarea) and the server determines that there are some validation errors, I want to automatically revert to displaying the textarea containing the user’s most recent changes. This is to avoid them losing the text they had typed in (it may have been a result of a server-side error or hitting the submit button accidentally before they are ready).
Is there any easy way to have jeditable build the edit control anew?
Ok, so here’s what I did to solve this. I hacked
jeditable.jsso that it expects JSON data as the response in the AJAXsuccesscallback triggered when submitting the in-place edit. In the JSON object is analertfield which I use as so};
So, in essence, if there is a non-NULL alert string, I just don’t to anything (except trigger the
callbackfunction, if defined). This seems to work fine, leaving thetextareafield in place with the user’s changes inside it. My callback alerts the user that the change wasn’t submitted by using the text indata.alert.