Topic: 0.6 equivalent of registerCallableObject

I downloaded the most recent copy from 0.6 from github but cannot find the comparable functionality for registering an entire class without needing to explicitly declare which functions you are registering.

In 0.5 (presuming I had already defined the structure of "someTestClass") I have (presently working):

require_once('xajax/xajax_core/xajaxAIO.inc.php');
$xajax = new xajax();
$A = new someTestClass();

$xajax->registerCallableObject($A);
$xajax->processRequest();

$javascript = $xajax->getJavascript('xajax/');

And it would work just fine. The 0.6 download includes a test file, "registerObjectTest.php" which attempts to do: $aMethodsTest = $xajax->register(XAJAX_CALLABLE_OBJECT, $myObj2);

Which throws an error from inside xajax's own libs...

Re: 0.6 equivalent of registerCallableObject

Hi,

Using xajax 0.6 and php 5.3 the following works:

<?php
include "xajax0.6b/xajax_core/xajax.inc.php";
$xajax = new xajax();
$xajax->configure("javascript URI",'xajax0.6b/');

class testing
{
  function __a(){}
  function b(){
    $resp = new xajaxResponse();
    $resp->alert('In function b');
    return $resp;
  }
  function c(){}
}
$t = new testing();
$xajax->register(XAJAX_CALLABLE_OBJECT,$t);
$xajax->processRequest();
?>
<!DOCTYPE html>
<html>
<head>
<?php $xajax->printJavascript(); ?>
</head>
<body>
<input type ="button" value="Click Me" onclick="xajax_testing.b()");
</body>
</html>

I get no errors with the test page.

Haven't tried php 5.2...

Edit:
Just tried with xajax 0.5 and php 5.3 and it doesn't work at all.
Look at the head with firebug...

Hope this helps...

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

Re: 0.6 equivalent of registerCallableObject

Thanks, I got that fixed...was missing some files that weren't coming up as required files, but were ultimately causing the problem. Also, looks like I had to create a deferred folder inside xajax_js

Another question: is there ANY 0.6b documentation, at all? Its been out for two years now and the main site's API documentation still references 0.5 without any links to a 0.6 documentation.

Re: 0.6 equivalent of registerCallableObject

I'm afraid there is no formal documentation yet. Last April the developers announced the continuation of development but there has not been any word from them since then.

I have not found a whole loot of differences.

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

Re: 0.6 equivalent of registerCallableObject

One thing I'm having problems is that in 0.5 I could (on an html element) have something like this:

<input type="button" value="Submit me!" onclick="var a = new Array(); a['someID'] = 45; xajax_SomeClass.someFunction(a);" />

But this will not work in 0.6, as far as I can tell, someFunction() gets called correctly, but 'a' is an empty array.

Re: 0.6 equivalent of registerCallableObject

On another note, I think I got it working by using:

<input type="button" value="Submit me!" onclick="xajax_SomeClass.someFunction({'someID': 45});" />