Hello,

I have a site where the user can insert text  into a textbox,   which
is  then returned via jason as xml (see code below). When there is no
html code in the text box the form works fine, but is the user puts
html code into the textbox "i.e. <b>Bold text</b> then the form does
not update (altho the data is returned and there are no errors
reported in firebug.

Any ideas?  Below is the relevant code

//This snippet shows the html in the rendering page where the text
below is to be inserted

        <td><b>Pre Text:</b></td>
        <td><TEXTAREA id="PreText" COLS=40 ROWS=1></TEXTAREA>
        </td>


// this snippet grabs the user entered text / store sthe result in sql
$('#reset').click(
function()
{

//Do I need some decoding here?????
var params = {PreText:""+$('#PreText').val()+""
        };



$.post("UpdateText.php", params,function(txt) {
    //$('#Result').text(txt);
$.post("FillForm.php", 0, function(xml) {

//Do I need some decoding here?????
        $("#Pretext").val($("PreText", xml).text());
       });
$("#Pretext").css({ color: "black"});
    });
   });

//This snippet grabs the data from an SQL database and works fine
unless the PreText field contains html -- in which case it returns
fine (but the field is not updated).


$.post("FillForm.php", 0, function(xml) {
        $('#alert').html("Loading the results from the Fill Form");
        $("#PreText").val($("PreText", xml).text());
       });

My guess is that I need to encode and decode the html before
processing the file as xml.  Any suggestions on how to do this?

Many thanks in advance

Reply via email to