Topic: Strange Error from what seems to be a simple program.

Version: 0.5 Final

Alright, here I go again, this time I'm making a program that checks the database, and if it does not find the information provided by the user for a specific field (in this case an ID field) it sends a soft alert to the user stating that their ID is not on the list and puts some information into a hidden field about what message they got to be saved in the database.

HOWEVER, if there wasn't an issue I wouldn't be posting this obviously so I'll start with the error:

PHP Fatal error:  Malformed object argument received: </xjxobj> <==> <xjxobj><e><k>maxLength</k><v>N500</v></e><e><k>tabIndex</k><v>N0</v></e><e><k>nodeName</k><v>SINPUT</v></e><e><k>nodeValue</k><v><xjxobj></xjxobj></v></e><e><k>nodeType</k><v>N1</v></e><e><k>parentNode</k><v><xjxobj><e><k>nodeName</k><v>STD</v></e><e><k>nodeValue</k><v><xjxobj></xjxobj></v></e><e><k>nodeType</k><v>N1</v></e><e><k>parentNode</k><v><xjxobj><e><k>nodeName</k><v>STR</v></e><e><k>nodeValue</k><v><xjxobj></xjxobj></v></e><e><k>nodeType</k><v>N1</v></e><e><k>parentNode</k><v><xjxobj><e><k>nodeName</k><v>STBODY</v></e><e><k>nodeValue</k><v><xjxobj></xjxobj></v></e><e><k>nodeType</k><v>N1</v></e><e><k>parentNode</k><v><xjxobj><e><k>nodeName</k><v>STABLE</v></e><e><k>nodeValue</k><v><xjxobj></xjxobj></v></e><e><k>nodeType</k><v>N1</v></e><e><k>parentNode</k><v><xjxobj><e><k>first_name</k><v><xjxobj><e><k>maxLength</k><v>N500</v></e><e><k>tabIndex</k><v>N0</v></e><e><k>nodeName</k><v>SINPUT</v></e><e><k>nodeValue</k><v><xjxobj></xjxobj></v></e><e><k>no in /home/company/company_site/public_html/company/xajax/xajax/xajax_core/xajaxArgumentManager.inc.php on line 244

Now then the code I will break up into three parts:
The Main File:

//Connect to Xajax.
require('/home/company/company_site/public_html/dir1/xajax_dir/xajax/xajax_core/xajax.inc.php');
//Connect to the specific Xajax code.
require('/home/company/company_site/public_html/dir1/xajax_dir/program_dir/program.common.php');

...

<?php $xajax->configure("javascript URI","https://company_site/company/xajax_dir/xajax/"); ?>
<?php $xajax->printJavascript(); ?>

<script type = 'text/javascript' language = 'Javascript'>
    <!--
        function personcheckid(){
            <?php
                $trigger = 0;
                $ifenabled = mysql_query("SELECT * FROM Building WHERE buildingID = " . $_SESSION['building'] . ";") or die(mysql_error()); 
                while($enabled = mysql_fetch_array( $ifenabled )){
                    if(($enabled['IDCheckOption'] == 'TRUE') || ($enabled['departmentOption'] != 'TRUE')){?>
                        if(document.getElementById('person_id') != ''){
                            xajax_checkid(document.getElementById('person_id'), <?php if(isset($_SESSION['building'])){echo $_SESSION['building'];}else{echo '0';} ?>);
                        }else{
                xajax_studentcheck('N/A');
            }
                    <?php
                    }
                    $trigger ++;
                }
                if($trigger == 0){
                    ?>
                        xajax_personcheck('N/A');
                    <?php
                }
            ?>
        }
    //-->
</script>

...

<span id = 'idswap'><input type = 'hidden' id = 'personcheck' value = '' /></span>

The Common File:

<?php
require_once ("/home/company/company_site/public_html/company/xajax_dir/xajax/xajax_core/xajax.inc.php");

$xajax = new xajax("/company/xajax_dir/program_dir/functions.php");
//$xajax->configure('debug', false);
$xajax->register(XAJAX_FUNCTION, "checkid");
$xajax->register(XAJAX_FUNCTION, "personcheck");
?>

The Function File:

<?php
function checkid($person_id, $building_id){
    #Connect to the database
    mysql_connect("localhost", "company", "password") or die(mysql_error() . " Line 136");
    mysql_select_db("company") or die(mysql_error() . " Line 137");
    $objResponse =& new xajaxResponse();
    
    $result = mysql_query("SELECT * FROM rentalPersons WHERE personID = " . $person_id . " AND buildingID = " . $building_id) or die(mysql_error()); 
    $testcheck = 0;
    while($row = mysql_fetch_array( $result )){
        if($testcheck == 0){
            $objResponse->call("xajax_personcheck", 'TRUE');
        }else{
            $result2 = mysql_query("SELECT * FROM building WHERE buildingID = " . $building_id) or die(mysql_error()); 
            while($row2 = mysql_fetch_array( $result2 )){
                $objResponse->alert('The ID ' . $person_id . ' does not seem to be in our lists, please check with ' . $row2['OfficeTitle'] . ' at ' .  $row2['Contact'] . ' or ' . $row2['PhoneNo'] . ' to see if you are supposed to be here.');
            }
            $objResponse->call("xajax_personcheck", 'MTOID');
        }
        $testcheck++;
    }
    if($testcheck == 0){
        $result = mysql_query("SELECT * FROM building WHERE buildingID = " . $building_id) or die(mysql_error()); 
        while($row = mysql_fetch_array( $result )){
            $objResponse->alert('The ID ' . $person_id . ' does not seem to be in our lists, please check with ' . $row['OfficeTitle'] . ' at ' .  $row['Contact'] . ' or ' . $row['PhoneNo'] . ' to see if you are supposed to be here.');
        }
        $objResponse->call("xajax_personcheck", 'FALSE');
    }
    return $objResponse;
}

function personcheck($personexists){
    $objResponse =& new xajaxResponse();
    $s = "
            <input type = 'hidden' id = 'personcheck' value = '" . $personexists . "' />
        ";
    $objResponse->assign("idswap", "innerHTML", $s);
    return $objResponse;
}

require("program.common.php");
$xajax->processRequest();
?>

Some additional background for this folly of a website is it is partially made with a framework known as Code Igniter, much to my chagrin, it was made that way by the coders that got the job of building the website before I did and I've been slowly trying to stamp it out while keeping the site functioning, an arduous process to say the least...

Why that is pertinent is because the entire form, including the field that triggers the xajax on change, is dynamically made by this Code Igniter on page load, the site loads normally however (and I PRAY this isn't the case, otherwise it will cause me to have to re-write a lot of code in very little time) it could be what is causing the error in this seemingly normal program.

Heeelp?

Aaron

Re: Strange Error from what seems to be a simple program.

I am really stumped on this one guys, I'm not just putting this up for posterity I have no idea what that error even means...

Re: Strange Error from what seems to be a simple program.

Alright, I removed the CI code from the equation and it STILL causes this error (*sigh of relief*)

Here's the test code I muddled together:

<?php
    //Connect to Xajax.
    require('/home/company/company.***/public_html/company/xajax_dir/xajax/xajax_core/xajax.inc.php');
    //Connect to the specific Xajax code.
    require('/home/company/company.***/public_html/company/xajax_dir/project/project.common.php');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gaspard Robe Company</title>
<link rel="shortcut icon" href="/company/images/favicon.ico" />
<?php $xajax->configure("javascript URI","https://www.company.***/company/xajax_dir/xajax/"); ?>
<?php $xajax->printJavascript(); ?>

<script type = 'text/javascript' language = 'Javascript'>
    <!--
        function personcheckid(){
            var checkvalue = '';
            if(document.getElementById('person_id') != ''){
                xajax_checkid(document.getElementById('person_id'), 22);
            }else{
                document.getElementById('personcheck').value = 'N/A';
            }
        }
    //-->
</script>
</head>
<body>
    <form>
        <input type = 'text' id = 'person_id' onchange = 'personcheckid()'/>
        <input type = 'text' id = 'switchto' />
        <input type = 'hidden' id = 'personcheck' value = '' />
    </form>
</body>

Re: Strange Error from what seems to be a simple program.

Now this is interesting...

When I loaded up the debug line again in xajax it seems that a third variable is being passed.


&xjxargs[]=
<xjxobj>
<e><k>tabIndex</k><v>N0</v></e>
<e><k>nodeName</k><v>SINPUT</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>nodeName</k><v>SFORM</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>nodeName</k><v>SBODY</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>nodeName</k><v>SHTML</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>documentElement</k><v>
<xjxobj>
<e><k>nodeName</k><v>SHTML</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>documentElement</k><v>
<xjxobj>
<e><k>nodeName</k><v>SHTML</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>documentElement</k><v>
<xjxobj>
<e><k>nodeName</k><v>SHTML</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>documentElement</k><v>
<xjxobj>
<e><k>nodeName</k><v>SHTML</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>documentElement</k><v>
<xjxobj>
<e><k>nodeName</k><v>SHTML</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>documentElement</k><v>
<xjxobj>
<e><k>nodeName</k><v>SHTML</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v>
<xjxobj>
<e><k>documentElement</k><v>
<xjxobj>
<e><k>nodeName</k><v>SHTML</v></e>
<e><k>nodeValue</k><v>
<xjxobj>
</xjxobj>
</v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v></v></e>
<e><k>childNodes</k><v>
<xjxobj>
<e><k>0</k><v>
<xjxobj>
<e><k>nodeName</k><v>SHEAD</v></e>
<e><k>nodeValue</k><v></v></e>
<e><k>nodeType</k><v>N1</v></e>
<e><k>parentNode</k><v></v></e>
<e><k>childNodes</k><v></v></e>
<e><k>firstChild</k><v></v></e>
<e><k>lastChild</k><v></v></e>
<e><k>previousSibling</k><v></v></e>
<e><k>nextSibling</k><v></v></e>
<e><k>attributes</k><v></v></e>
<e><k>ownerDocument</k><v></v></e>
<e><k>namespaceURI</k><v></v></e>
<e><k>prefix</k><v></v></e>
<e><k>localName</k><v>SHEAD</v></e>
<e><k>ELEMENT_NODE</k><v>N1</v></e>
<e><k>ATTRIBUTE_NODE</k><v>N2</v></e>
<e><k>TEXT_NODE</k><v>N3</v></e>
<e><k>CDATA_SECTION_NODE</k><v>N4</v></e>
<e><k>ENTITY_REFERENCE_NODE</k><v>N5</v></e>
<e><k>ENTITY_NODE</k><v>N6</v></e>
<e><k>PROCESSING_INSTRUCTION_NODE</k><v>N7</v></e>
<e><k>COMMENT_NODE</k><v>N8</v></e>
<e><k>DOCUMENT_NODE</k><v>N9</v></e>
<e><k>DOCUMENT_TYPE_NODE</k><v>N10</v></e>
<e><k>DOCUMENT_FRAGMENT_NODE</k><v>N11</v></e>
<e><k>NOTATION_NODE</k><v>N12</v></e>
<e><k>tagName</k><v>SHEAD</v></e>
<e><k>id</k><v>S</v></e>
<e><k>title</k><v>S</v></e>
<e><k>lang</k><v>S</v></e>
<e><k>dir</k><v>S</v></e>
<e><k>className</k><v>S</v></e>
<e><k>profile</k><v>S</v></e>
<e><k>offsetTop</k><v>N0</v></e>
<e><k>offsetLeft</k><v>N0</v></e>
<e><k>offsetWidth</k><v>N0</v></e>
<e><k>offsetHeight</k><v>N0</v></e>
<e><k>offsetParent</k><v></v></e>
<e><k>innerHTML</k><v>S<![CDATA[

Now why would xajax be passing all this rubbish?

Re: Strange Error from what seems to be a simple program.

Hi Mord_Sith,

Well, I messed with your code and the following works:

<?php

    //Connect to Xajax.
require_once("xajax/xajax_core/xajax.inc.php"); 
$xajax = new xajax();                                                     
function checkid($person_id, $building_id){
        $objResponse =& new xajaxResponse();
        $objResponse->call("xajax_personcheck",'MTOID');
    return $objResponse;
}

function personcheck($personexists){
    $objResponse =& new xajaxResponse();
    $s = "<input type = 'hidden' id = 'personcheck' value = '" . $personexists . "' />";
    $objResponse->assign("idswap", "innerHTML", $s);
    $objResponse->alert("personcheck said : $s");
    return $objResponse;
}
$xajax->configure('debug',true);
$xajax->register(XAJAX_FUNCTION,'checkid');
$xajax->register(XAJAX_FUNCTION,'personcheck');
$xajax->processRequest();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<? $xajax->printJavascript('xajax'); ?>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Gaspard Robe Company</title>
<script type = 'text/javascript' language = 'Javascript'>
    <!--
        function personcheckid(){
            var checkvalue = '';
            if(xajax.$('person_id').value != ''){
                xajax_checkid(xajax.$('person_id').value, 22);
            }else{
                xajax.$('personcheck').value = 'N/A';
            }
        }
    //-->
</script>
</head>
<body>
    <div id="idswap" name="idswap"></div><br/>
    <form>
        <input type = 'text' id = 'person_id' onchange = 'personcheckid()'/>
        <input type = 'text' id = 'switchto' />
        <input type = 'hidden' id = 'personcheck' value = '' />
    </form>
</body>
</html>

I believe the problem was in your JS function. You were passing the DOM object instead of its value.

Hope this helps...:)

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: Strange Error from what seems to be a simple program.

Well I certainly feel like a fool big_smile tongue

Now it's calling the function properly when I added .value to the JS function that calls the xajax.

Thanks Ed!

Re: Strange Error from what seems to be a simple program.

Hello,

I have the same problem with a function when I try to use two arguments.

The function works with one argument, but when I try to put a second, it doesn't work, I have this error :

<br />
<font size='1'><table class='xdebug-error xe-fatal-error xe-scream' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> SCREAM: Error suppression ignored for</th></tr>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Fatal error: Malformed object argument received: &lt;/xjxobj&gt; &lt;==&gt; &lt;xjxobj&gt;&lt;e&gt;&lt;k&gt;style&lt;/k&gt;&lt;v&gt;&lt;xjxobj&gt;&lt;e&gt;&lt;k&gt;background&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;backgroundAttachment&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;backgroundColor&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;backgroundImage&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;backgroundPosition&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;backgroundRepeat&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;border&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderCollapse&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderColor&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderSpacing&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderStyle&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderTop&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderRight&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderBottom&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderLeft&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderTopColor&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderRightColor&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderBottomColor&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderLeftColor&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderTopStyle&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderRightStyle&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderBottomStyle&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderLeftStyle&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderTopWidth&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderRightWidth&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k&gt;borderBottomWidth&lt;/k&gt;&lt;v&gt;S&lt;/v&gt;&lt;/e&gt;&lt;e&gt;&lt;k in D:\wamp\www\Postprod\xajax_core\xajaxArgumentManager.inc.php on line <i>244</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0019</td><td bgcolor='#eeeeec' align='right'>927264</td><td bgcolor='#eeeeec'>{main}(  )</td><td title='D:\wamp\www\Postprod\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.0209</td><td bgcolor='#eeeeec' align='right'>1003648</td><td bgcolor='#eeeeec'>action->__construct(  )</td><td title='D:\wamp\www\Postprod\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>6</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>0.0236</td><td bgcolor='#eeeeec' align='right'>1200072</td><td bgcolor='#eeeeec'>xajax->xajax(  )</td><td title='D:\wamp\www\Postprod\private\action.class.php' bgcolor='#eeeeec'>..\action.class.php<b>:</b>25</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>0.0236</td><td bgcolor='#eeeeec' align='right'>1200520</td><td bgcolor='#eeeeec'>xajax->__wakeup(  )</td><td title='D:\wamp\www\Postprod\xajax_core\xajax.inc.php' bgcolor='#eeeeec'>..\xajax.inc.php<b>:</b>181</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>5</td><td bgcolor='#eeeeec' align='center'>0.0428</td><td bgcolor='#eeeeec' align='right'>1915928</td><td bgcolor='#eeeeec'>xajaxArgumentManager::getInstance(  )</td><td title='D:\wamp\www\Postprod\xajax_core\xajax.inc.php' bgcolor='#eeeeec'>..\xajax.inc.php<b>:</b>279</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>6</td><td bgcolor='#eeeeec' align='center'>0.0428</td><td bgcolor='#eeeeec' align='right'>1916352</td><td bgcolor='#eeeeec'>xajaxArgumentManager->xajaxArgumentManager(  )</td><td title='D:\wamp\www\Postprod\xajax_core\xajaxArgumentManager.inc.php' bgcolor='#eeeeec'>..\xajaxArgumentManager.inc.php<b>:</b>393</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>7</td><td bgcolor='#eeeeec' align='center'>0.0429</td><td bgcolor='#eeeeec' align='right'>1926352</td><td bgcolor='#eeeeec'><a href='http://www.php.net/array_walk' target='_new'>array_walk</a>
(  )</td><td title='D:\wamp\www\Postprod\xajax_core\xajaxArgumentManager.inc.php' bgcolor='#eeeeec'>..\xajaxArgumentManager.inc.php<b>:</b>378</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>8</td><td bgcolor='#eeeeec' align='center'>0.0431</td><td bgcolor='#eeeeec' align='right'>2100088</td><td bgcolor='#eeeeec'>xajaxArgumentManager->argumentDecodeXML(  )</td><td title='D:\wamp\www\Postprod\xajax_core\xajaxArgumentManager.inc.php' bgcolor='#eeeeec'>..\xajaxArgumentManager.inc.php<b>:</b>378</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>9</td><td bgcolor='#eeeeec' align='center'>0.8587</td><td bgcolor='#eeeeec' align='right'>2881464</td><td bgcolor='#eeeeec'><a href='http://www.php.net/trigger_error' target='_new'>trigger_error</a>
(  )</td><td title='D:\wamp\www\Postprod\xajax_core\xajaxArgumentManager.inc.php' bgcolor='#eeeeec'>..\xajaxArgumentManager.inc.php<b>:</b>244</td></tr>
</table></font>

I don't understand how you resolved the problem.

here is my function :

public function delAnswer($idAns, $idDiv)
    {
        $reponse=new xajaxResponse;
        $reqDel="DELETE FROM t_answer WHERE ID_ANSWER='".$idAns."';";
        $this->DB->queryWithoutResult($reqDel);
        $html="delete";
        $reponse->assign($idDiv,'innerHTML', $html);
        return $reponse;
    }

can you explain how to use the replace function with an example I don't don't understand the word : needle, in the doc

Thank you

Re: Strange Error from what seems to be a simple program.

Post some code - php and html.

The original problem was solved by passing the value of the element and not the element itself.

Here's a link to the php manual str_replace function. It explains the needle and the haystack:
http://php.net/manual/en/function.str-replace.php

Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: Strange Error from what seems to be a simple program.

I upgraded xajax to 0.6 and the problem seems to have disappear...

but now Firebug says :

SyntaxError: missing ) in parenthetical
http://localhost/Postprod/xajax_js/xajax_core.js
Line 383

here is the html that call the function

<table>
    <div id="answers">
    <?php
        
        $ansTab=$action->dispAns($id); // this works, it returns a table
        
        foreach($ansTab as $i=>$row)
        {
            $name="del".$i."";
            $id=$ansTab[$i]->ID_ANSWER;
            $answer=stripslashes($ansTab[$i]->ANS_STATEMENT);
            echo("<div id=".$name."><tr><td>".($i+1)."° : ".$answer."</td><td><input type=\"button\" value=\"Delete\" name=\"".$name."\" onclick=\"xajax_delAnswer(".$id.",".$name."); return false;\"/></td></tr></div>");
            
        }
    
    ?>
    

    </div>
    </table>

the query is executed but there isno  return.

here is the function delAnswer

public function delAnswer($idAns, $name)
    {
        $reponse = new xajaxResponse;
        $reqDel="DELETE FROM t_answer WHERE ID_ANSWER='".$idAns."';";
        $this->DB->queryWithoutResult($reqDel);
        $reponse->assign(actualize); // I don't know what to do here, I would like to refresh the div answers
        return $reponse;
    }

Thank you