Page 1 of 1

Using xajax in a module

Posted: Mon Jun 30, 2008 1:45 pm
by solaris23
Hello I'm trying to use Xajax in a module I have maid, but it actually don't work. (I have started using xajax and progamming ms module very recently)
So, here is my code related to xajax in my action.default.php :


       function validPostal($codepo){
if($this->isValidCodePostal($codepo) !== FALSE){
return 'Ville :'.$this->isValidCodePostal($codepo).'';
}else{
return '';
}

}

        require_once('lib/xajax/xajax.inc.php');
$xajax = new xajax();
$xajax->registerFunction('validPostal');
$xajax->processRequests();

// ..............
// here I'm sending smarty tags....

$ajaxiser = 'onkeyup = "xajax_validPostal(codepostal);"';
$this->smarty->assign_by_ref('votrecodepostal', $this->Lang('votrecodepostal'));
$this->smarty->assign_by_ref('codepostal', $this->CreateInputText($id, 'codepostal', $codepostal, 30, 155, $ajaxiser));
[/sup]

But sadly this don't want to work and I get the following firebug message :
xajax_validPostal is not defined

I'm sure I'm missing something simple, but still can't figure what.....
Any advice are welcome !

Re: Using xajax in a module

Posted: Mon Jun 30, 2008 1:53 pm
by cyberman
Have you tried to use Ajax made simple module?

It makes Xajax usable for CMSms ...

Re: Using xajax in a module

Posted: Mon Jun 30, 2008 2:08 pm
by solaris23
I just install it, but I don't see any difference, I'm still getting the same error.
Can someone seen something wrong in my code ?

Thanks in advance..

Re: Using xajax in a module

Posted: Mon Jun 30, 2008 3:08 pm
by solaris23
Ok I had, now, wrote this code :
No error message, but no action, and I don't find the way of using onkeyup
with Ajax made simple.....

so in my action.default.php
$ajax=$this->GetModuleInstance("AjaxMadeSimple");
    $ajax->RegisterAjaxRequester($this->GetName(),"verifcp","localite","validPostal","validPostal.php",array(),array("codepostal"=>"clear"));


$this->smarty->assign_by_ref('votrecodepostal', $this->Lang('votrecodepostal'));
$this->smarty->assign_by_ref('codepostal', $this->CreateInputText($id, 'codepostal', $codepostal, 30, 155));
[/sup]
in my modulename.module.php

function validPostal($codepo){
if($this->isValidCodePostal($codepo) !== FALSE){
return 'Ville :'.$this->isValidCodePostal($codepo).'';
}else{
return 'rien';
}

}


and in my template :


{$votrecodepostal}*:
{$codepostal}


Re: Using xajax in a module

Posted: Tue Jul 15, 2008 12:59 pm
by cyberman
Have you tried to use Firefox / Firebug plugin to check it?