Using xajax in a module

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
solaris23
New Member
New Member
Posts: 9
Joined: Fri Jun 27, 2008 9:02 am

Using xajax in a module

Post 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 !
Last edited by solaris23 on Mon Jun 30, 2008 1:47 pm, edited 1 time in total.
cyberman

Re: Using xajax in a module

Post by cyberman »

Have you tried to use Ajax made simple module?

It makes Xajax usable for CMSms ...
solaris23
New Member
New Member
Posts: 9
Joined: Fri Jun 27, 2008 9:02 am

Re: Using xajax in a module

Post 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..
solaris23
New Member
New Member
Posts: 9
Joined: Fri Jun 27, 2008 9:02 am

Re: Using xajax in a module

Post 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}

Last edited by solaris23 on Mon Jun 30, 2008 3:10 pm, edited 1 time in total.
cyberman

Re: Using xajax in a module

Post by cyberman »

Have you tried to use Firefox / Firebug plugin to check it?
Post Reply

Return to “Developers Discussion”