AnanthaKN / jquery-in-place-editor

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

what would you do if you need to add a dynamic value to the param ? #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

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

if i have a table like this

<table>
<thead>
<tr>
<th>id</th>
<th>first name </th>
<th>last name </th>
</tr>
</thead>

<tbody>
<tr>
<td class="id">1</td>
<td class="fname">sarmen</td>
<td class="lname">mikey</td>
</tr>

<tr>
<td class="id">2</td>
<td class="fname">john</td>
<td class="lname">angelo</td>
</tr>

<tr>
<td class="id">3</td>
<td class="fname">sarmen</td>
<td class="lname">grande</td>
</tr>
</tbody>
</table>

and my js looked something like this

$("td.fname").editInPlace({
    url: 'ajax.php',
    params: '',
    show_buttons: true          
});

then lets say i click on the first record to edit it which is fname of sarmen. 
how can i pass a param that only accociates id 1 ? because if i do a query of 
lets say "update tbl_users set fname = '$_POST['update_value']' where fname = 
'$_POST['original_html']'"

(note: im just showing an example so no need to clean posts if that was 
bothering you :)   )

if i run this query the fname of sarmen will update in two records rather than 
one. How can i only update to id of 1 being to update only one record. 

What version of the product are you using? On what operating system? 2.2.0 on 
mac snow leopard

Please provide any additional information below.

Original issue reported on code.google.com by sarme...@gmail.com on 10 Jan 2011 at 12:11

GoogleCodeExporter commented 9 years ago
i found the solution. for anyone wanted to know as well its a matter of 
modifying your code.

http://stackoverflow.com/questions/4646967/how-to-add-a-dynamic-param

Original comment by sarme...@gmail.com on 10 Jan 2011 at 7:51

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
if i am displaying the records from the database, so how can i access the value 
of that variable.

i am using this 

params: "name=<?php echo $row[2];?>",

but its not working. :(

Original comment by asifqua@gmail.com on 12 Jan 2011 at 8:52

GoogleCodeExporter commented 9 years ago
if you use the jquery code in the same php page, then it works. 
here is the the sample code.

$("#Company_Name").editInPlace({
        url: 'server.php',
        bg_out: '#21281D',
        show_buttons: true,
        params: "name=<?php echo $row[3]; ?>",
        saving_image: "images/loader.gif"

    });

Original comment by asifqua@gmail.com on 12 Jan 2011 at 9:43