theoreticsinc / jquery-datatables-editable

Automatically exported from code.google.com/p/jquery-datatables-editable
0 stars 0 forks source link

Ampersand within the edit #68

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create an editable field with a save button in a Datatable
2. double-click to edit
3. type "blah & blah"
4. click the save button

What is the expected output? What do you see instead?
I would like to see an accepted entry.  But when I echo back $value I get an 
error as the string returned value is not the same as datatables posted.  All 
other edits seem to work.

What version of the product are you using? On what operating system?
versions: 
datatables.min 1.7.5 
jeditable 1.6.2
on a mac with Firefox 3.6.22

Please provide any additional information below.
I'm using an ajax call to php to echo $value.
What is returned is "blah & blah" so the entry and return values are 
mismatched.

Thanks

Original issue reported on code.google.com by ourt...@ourtownamerica.com on 26 Sep 2011 at 7:27

GoogleCodeExporter commented 8 years ago
Hi,

You are responsible for the response returned by the server side page so could 
you return the same value that is entered(without encoding). This value is only 
used for validation.

Regards,
Jovan

Original comment by joc...@gmail.com on 27 Sep 2011 at 11:02

GoogleCodeExporter commented 8 years ago

Original comment by joc...@gmail.com on 29 Sep 2011 at 6:14

GoogleCodeExporter commented 8 years ago
How do we disable the converting of the ampersand to its HTML entity when the 
cell is double-clicked?  

Original comment by blake.br...@archlearning.com on 21 Oct 2011 at 5:17

GoogleCodeExporter commented 8 years ago
has this issue been resolved?

Original comment by ericdecoff on 26 Dec 2011 at 4:22

GoogleCodeExporter commented 8 years ago
This is my work-a-round:

in jquery.editable.js 

above line 

content.apply(form, [input_content, settings, self]);

add 

        // added to replace '&' to '&'  
        self.revert = self.revert.replace('&','&');
        input_content = input_content.replace('&','&');

                content.apply(form, [input_content, settings, self]);

in jquery.dataTables.editable.js:

change line in oDefaultEditableSettings:

from
          if (sNewCellValue == sValue) {
to
          // Ampersand fix 
          if (sNewCellValue == sValue || sNewCellValue == sValue.replace('&','&')) {

Original comment by ericdecoff on 26 Dec 2011 at 5:52

GoogleCodeExporter commented 8 years ago
Confirming that ericdecoff's workaround fixes this issue for me.

Original comment by ske...@gmail.com on 20 Apr 2012 at 12:21

GoogleCodeExporter commented 8 years ago
I changed ericdecoffs code to 

self.revert = self.revert.replace(/&/g,'&');
input_content = input_content.replace(/&/g,'&');

This works for multiple Ampersand's

Original comment by MikeSolo...@googlemail.com on 29 Oct 2012 at 3:43