CodeIgniter Forums
Cjax (Ajax Framework) for CodeIgnater v5.1 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forum-22.html)
+--- Thread: Cjax (Ajax Framework) for CodeIgnater v5.1 (/thread-54602.html)



Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 09-16-2012

[eluser]Ajaxboy[/eluser]
---------------------------------------------------------------------------
|
| There is a new version here: 5.3
|
| http://ellislab.com/forums/viewthread/229077/
|
|-------------------------------------------------------------------------

AjaxFw 5.1-Stable is available!

Maintenance Release

Thank you so much for all these that took the time to contact me to let me know about issues you were having, that has helped us to find some hard to find bugs.

If some of you had not taken the time to report these problems I probably would have nothing to release!, be sure to let me know if you find issues or limitations.


Proceed to download

https://sourceforge.net/projects/cjax/files/CodeIgnater/


Changes and new Features:

* Support for PHP 5.2

* New usage for Exec events:
Code:
$ajax->click($element_id, $actions);
$ajax->change($element_id, $actions);
$ajax->keyup($element_id, $actions);
$ajax->keydown($element_id, $actions);
$ajax->blur($element_id, $actions);

**Update in all demos, you can see these changes

This is alternative replacement wrapper of the clasic:

$ajax->Exec();

* Multiple APIs now work on overlays callbacks
for example you may use Cjax in overlays elements

This means that you can assign actions in an overlay before the overlay is loaded, for example an overlay having an ajax form, would require you to assign the form-api to the overlay (like in this example: http://cjax.sourceforge.net/examples/ajax_login.php); , and this was possible in 5.0, however this functionality was not previously tested with with multiple APIs in the overlay, and only could support one API, now it supports multiple in case you wanted to do other ajax operation within the scope of the overlay, now you in 5.1 you can have work with the scope of the overlay with as many APIs as you please, see sample below:

Eg:

Code:
$overlay = $ajax->overlay('resources/html/login.html');

//work within the scope of the overlay (elements in resources/html/login.html)

//type something in field (within the overlay), and it will change the title
$overlay->keyup('field1', $ajax->document('title','|field1|'));

//Example of adding one more operation in the overlay
$overlay->click('some_image', $ajax->call('ajax.php?url/to/controller'));

//submit ajax-form in the overlay
$overlay->click('button1', $ajax->form('ajax.php?ajax_login/handler'));

//assign the overlay to an element so when you click on it, the overlay pops
$ajax->click('#some_link', $overlay);
On 5.0, this was limited to 1 single API. Now you may add as many as you want.

* Minor improvements & minor bugs fixed
* Expanded the number of parameters you can pass from a to f to a to z.
* Fixed "select" bug that chopped off last item in the array list in "select" ajax API.
* Allow to require 'ajax.php' for codeIgnater, when before it had to be 'ajaxfw.php', (the old way still works)
* Validate & Uploader plugins integration
Plugin validate now integrates with plugin uploader.
Example:

Code:
$ajax->validate('buttonID', 'ajax.php?optional/pre/action', $rules)->uploader(
array(
  'target' => 'directory/where/files/are/uploaded/to',
  'text'=> 'Uploading Files..',
  'url' => 'ajax.php?optional/post/action', //form post after the files are uploaded
  'form_id' => 'form_id',
  'success_message' => 'Files Uploaded Successfully..',
  'suffix' => time()
  )
);




Demos
http://cjax.sourceforge.net/examples/




-cj





Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 09-17-2012

[eluser]Ajaxboy[/eluser]
If you like Cjax be sure to leave a review (and vote) here: http://sourceforge.net/projects/cjax/reviews/




Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 10-29-2012

[eluser]Ajaxboy[/eluser]
New sample added:

Full fledged ajax calculator, unlike other "calculators" from other frameworks and libraries, this ajax calculator is a complete basic calculator. The sample code is included in the 5.2 samples download package.

Demo:

http://cjax.sourceforge.net/examples/calculator.php

https://sourceforge.net/projects/cjax/files/Demos/


Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 10-31-2012

[eluser]salvomil[/eluser]
Hi Ajaxboy,

I ask if is possible to resolve the following problem:

in an ajax call for autosearch (populating a div) :

Code:
$ajax->keyup('search_username|search_cognome|search_nome',$ajax->call(base_url().'ajax.php?calls/search_utente/|search_username|/username/|search_cognome|/cognome/|search_nome|/nome/|search_groups|/group_id/|search_stato|/status/','div_search_response'));

well if a form value is blank then the values passed stops to this field,

for example:

this is field values

|search_username| = salv
|search_cognome| = milite
|search_nome| = '' // blank value
|search_group| = 1
|search_stato| = active

in search_utente function of calls controller,
Code:
function search_utente($search1='', $field1='', $search2='', $field2='', $search3='', $field3='', $search4='', $field4='', $search5='', $field5='')
{
echo $search1 ,'-', $field1, '-', $search2 ,'-', $field2, '-' , $search3, '-', $field3, '-' , $search4, '-', $field4, '-', $search5,'-', $field5;
......
         ......
}

I get salv-username-milite-cognome------

where the |search_group| value (and field_name group_id) and |search_stato| value (and field_name status) are not present (because of the empty |search_nome| value)

What can I do to avoid this?

Thank you




Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 10-31-2012

[eluser]Ajaxboy[/eluser]
Hello salvomil,

So the issue is that you are passing two slashes together in the url.


Solution #1
If all these fields are in the same form, I'd recommend using $ajax->form() instead of $ajax->call(), this would automatically submit $_POST all the items without passing them through the url.

To get the values in the controller parameters you will need to name them in alphabetic order ( see form example: http://cjax.sourceforge.net/examples/send_form.php)

Eg:
Code:
$ajax->keyup('search_username|search_cognome|search_nome',$ajax->form(base_url().'ajax.php?calls/search_utente/',null,'div_search_response'));

Solution #2

A possible way around is adding prefixes:

Code:
'ajax.php?calls/search_utente/|search_username|/username/field:|search_cognome|/cognome/field:|search_nome|/nome/field:|search_groups|/group_id/field:|search_stato|/status/'

Then you would have to remove the prefix of each value, a little bulky for my taste but could work for you.

Solution #3
Using alternative url type: (see: http://cjax.sourceforge.net/docs/url_styles.php)

This would allow you to do the url in a more flexible way:

Code:
'ajax.php?controller=calls&function=search_utente&a=|search_username|&b=|search_cognome|&c=|search_group|'

If you name them a,b,c,d,e,f etc, they will be passed also as parameters. and so on..



Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 10-31-2012

[eluser]salvomil[/eluser]
Thank you,
all three way are valid, but he last one is ok for me.

I tried it and now it's ok.


Again, thank you.


Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 11-02-2012

[eluser]Ajaxboy[/eluser]
FYI, this issue has been fixed in Cjax 5.3 http://ellislab.com/forums/viewthread/229077/


Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 11-07-2012

[eluser]kimme[/eluser]
Hello...
Thanks for your sharing. Its very useful for us. From last month, I was looking for cjax. cjax is an MVC oriented, lightweight (>100kb) ajax framework aimed at PHP applications/sites.


Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 11-19-2012

[eluser]dnishe[/eluser]
Please How can i install cjax, am new to it, i tried doing it via the readme.html description but nothing, so pls how can i install it


Cjax (Ajax Framework) for CodeIgnater v5.1 - El Forum - 11-20-2012

[eluser]Ajaxboy[/eluser]
I answered your question in the other thread: http://ellislab.com/forums/viewthread/220312/P70/