value in text area moved when called using ajax
I'm using jquery-1.4.2 with PHP.
I have a grid of records with a link to a form i'd like to use to edit the row with.
The form is built using php, and works as expected when called just using a regular html link.
When the form is called using $(".ajax").click(function(event), the form comes up, but the textarea(s) are messed up;
<textarea>Stuff for the text area</textarea>
becomes
<textarea></textarea>Stuff for the text area
It does this for each textarea on the form.
I've looked through this site, and googled all evening, and can't find anything on it. Does anyone have any ideas? If i hardcode the values in the form class, it still messes up.
Very very confused. I've tried a few other versions of Jquery, but to no avail.
Thanks!
Michael
A working extract of the program is at: http://holstebro.ca/dev/controllers/test.html
my form is built by calling the following code;
<?
//html_ctrl_tbl_frm_debug.php controller
include 'class.view.site.debug.php';
//$db = new site();
$AccountID = 1;
$siteid = (isset($_REQUEST['siteid'])) ? $_REQUEST['siteid'] : 0;
$action = (isset($_REQUEST['action'])) ? $_REQUEST['action'] : "index";
switch ($action) {
case "index":
//$rows = $db->loadlist($AccountID);
$viewForm = new view_site();
echo $viewForm->renderGrid($rows);
break;
case "view":
//$row = $db->loadsingle($AccountID, $siteid);
$viewForm = new view_site();
echo $viewForm->renderSingleView($row[0]);
break;
case "edit":
//$row = $db->loadsingle($AccountID, $siteid);
$viewForm = new view_site();
echo $viewForm->renderSingleEdit($row[0]);
break;
}
?>
the class to build the form is;
<?
/*
class.view.site.php
*/
class view_site {
function renderSingleEdit($row) {
$id = 1;
$name = "fred";
$notes = "this is a test";
$frmOutHtml = "
<form id='frm_site' name='frm_site' class='detailForm' action='' method='post' >
<table id='frm_tbl_site' class='detailFormTbl' border=1 >
<tr>
<td><label for='col_SiteID'>SiteID</label></td>
<td><input type='text' id='col_SiteID' name='SiteID' maxlength='6' size='6' value='$id' /></td>
</tr>
<tr>
<td><label for='col_SiteName'>SiteName</label></td>
<td><input type='text' id='col_SiteName' name='SiteName' maxlength='25' size='' value='$name' />
</td>
</tr>
<tr>
<td><label for='col_Notes'>Notes</label></td>
<td><textarea id='col_Notes' name = 'Notes' cols='50' rows='5' />$notes</textarea>
</td>
</tr>
<tr>
<td><input type='submit' name='btn_site_cancel' class='BtnCancel' value='Cancel' /></td>
<td><input type='submit' name='btn_site_submit' class='BtnSubmit' value='OK' /></td>
</tr>
</table>
<input type='hidden' name='action' value='update'>
</form>
<a href='test.html'>Back</a>
";
return $frmOutHtml;
}
}
?>