AnanthaKN / jquery-in-place-editor

Automatically exported from code.google.com/p/jquery-in-place-editor
Other
0 stars 0 forks source link

need an optional variable to pass... #100

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. When i need to update the elements in db how to track which row the elements 
should be updated
2. tried to echo the params but failed.

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
v2.2.1 on win7 with FF4/5

Please provide any additional information below.
need to pass an identifier or variable to the php page (server) so that return 
can be updated accordingly. for eg- update_value, element_id, new_identifier. 
So that while putting the value in the DB it goes to the right row.

Original issue reported on code.google.com by mynul9...@gmail.com on 18 Aug 2011 at 7:00

GoogleCodeExporter commented 8 years ago
Ok the way I did this was hacking the javascript and using the "name" 
attribute". I have a report which I want to allow in-place editing but the 
field to identify what to edit (the WHERE in by UPDATE statement) had to come 
from the php and not something static for all in place edit fields. SO I added 
a name attribute to the element wrapping my data where the value of it is the 
value of that key field.
I also hacked the code to have the id of the element be passed in the POST as 
if it were the name attribute of an input form (saved me having to code special 
in my server php for the edit in place).
The hack in the javascript is as follows:
under line 469:
        handleSubmitToServer: function(enteredText) {
I modified the variable:
                var data = this.settings.update_value + '=' + encodeURIComponent(enteredText)
                        + '&' + this.settings.element_id + '=' + this.dom.attr("id")
                        // added to have the elements id be the param name and its value the data
                        + '&' + this.dom.attr("id") + '=' + encodeURIComponent(enteredText)
                        + '&record=' + this.dom.attr("name")
                        // end edits
                        + ((this.settings.params) ? '&' + this.settings.params : '')
                        + '&' + this.settings.original_html + '=' + encodeURIComponent(this.originalValue) /* DEPRECATED in 2.2.0 */
                        + '&' + this.settings.original_value + '=' + encodeURIComponent(this.originalValue);

Original comment by pel...@gmail.com on 2 Mar 2012 at 8:45

GoogleCodeExporter commented 8 years ago
Hey, OK, I know that my solution is like a scratching with left hand behind 
right ear, but what about $_SESSIONS? You can save id of the row to the SESSION 
and read it during update in "server.php".

Original comment by sebecek....@gmail.com on 21 Jan 2014 at 11:27