Method list:
- link
- remoteFunction
- remoteTimer
- form
- submit
- observeField
- observeForm
- autoComplete
- drag
- drop
- dropRemote
- slider
- editor
- sortable
Update: New methods have arrived!
New methods:
Comments
Post a comment
Why should we use jQuery rather than Prototype?
- It's much faster (as you can see on benchmark)
- It's light weight
- CSS3 Compiliant
- Cross-browser
2010-03-18 04:37:19
¡que bueno que se cuente con Jquery es este frame work! Se que a muchos les agradara. saludos
2010-03-18 14:42:09
Hi,
Just by fast checking the source code it seams like this class requires PHP 5 and won't be working as expected with PHP 4 (due to the constructors), isn't that a bit weird since CakePHP only have stable versions for PHP 4+ ?
Regards
Tobias
2010-03-18 19:23:00
I've checked your helper and found that $this->RequestHandler->isAjax() in controller returns false, if use default contentType. I don't see any reason why this happens...
2010-03-18 20:01:26
Oops, sorry. It was Security component that was the cause. Don't look at my previous post.
2010-03-18 20:07:59
Tobias: this constructor is used in cakePHP core. So I think that it'll work with PHP 4+
2010-03-24 04:14:06
Thank you very much for your efforts. I appreciate it. Will test it soon. Again , thx. Greetings from Germany
2010-03-26 14:16:06
Pretty nice! Just what I wanted.
maybe this helper becomes standard in a year.
2010-03-29 06:48:40
I have seen this helper methods and documentation, but still didnt use........ I am sure from its docs that will be great helper for Ajax lovers in cakephp
2010-04-01 06:35:13
thx, really nice work
2010-04-06 13:06:53
Nice Work.Pls i am having an issue. when using the link, its generating Event.observe which is a prototype event. Pls how do handle this issue. I am using the latest stable version of cakephp.Thanks
2010-04-06 15:51:41
Pls i sincerely apologize for the multiple submissions, my internet speed was very slow and i kept refreshing not knowing that it was submitting to your site. Pls i accept my apologies....still expecting your reply. Thanks
2010-04-06 20:41:06
nice work
2010-04-07 10:28:35
David U:
You should place javascript.php in your helpers directory.
2010-04-07 10:54:29
kvas thanks a million. It worked! Great Job...Do have a great day
2010-04-09 07:36:14
Hi I am trying to upload file using ajax form but it is not working.
2010-04-09 17:34:23
Abdul: You need other helper for ajax file uploading.
This helper, like base Ajax Helper, is not including this feature.
2010-04-10 22:15:53
Thank you for your great effort and i will test it :)
2010-04-13 00:05:30
Works great, many thanks ;]
2010-04-16 19:53:14
Muchas Gracias por este helper, es maravilloso, hace rato estaba buscando algo asi.
Eternamente agradecido
2010-04-17 23:18:40
Very nice helper!
Thanks!
2010-04-20 10:49:10
Finaly! That is , what i need! Thanks!
2010-04-23 11:13:36
Great helper...
2010-05-12 09:34:34
Hello,
I am having a problem. i want to update/add row to table but my response contains <html tags. i only want <td elements i have tried setting layout=NULL but not working.
any help
2010-05-12 09:53:46
well i have checked the response. it contains what i am looking for but while updating it is removing td elements :/ I am updating <tr> element on form submit
2010-05-13 08:44:20
khan:
You can try:
$this->layout = 'ajax';
ajax layout should placed in app/view/layouts/ (it is placed here at default).
2010-05-17 16:11:25
Hi kvas,
I'm using your helper (it's excelent).
So, i am with problems to use it in Google Chrome. An error message appears on every ajax request:
XML cannot be read [CORE/cake/libs/xml.php, line 883]
But the ajax works. I read that the problem is solved setting the request header type (request.setRequestHeader( ‘Content-type’, ‘text/plain’);”;).
How can I fix it in your helper?
2010-05-17 18:06:36
Hi Geidivan J.!
You can try additional option named 'contentType'...
Example:
<?php echo $ajax->link(
'View Post',
array( 'controller' => 'ajax', 'action' => 'view', 1 ),
array( 'update' => 'post', 'contentType' => 'text/plain')
);
?>
I'll glad if you write if this helped. BTW. I'm not getting this error in my chrome :/
2010-05-17 19:33:42
Thanks kvas, it worked perfectly (your answers are fast).
2010-05-18 06:15:44
Hi there,
What is the proper call to check if ajax is being used in my controller? I tried isAjax() as well as $this->requestHanlder->isAjax() and neither seem to work.
Thanks!
2010-05-18 09:04:34
Hi Eric!
I'm using
$this->params['isAjax']
and it's working for me :)
2010-05-21 06:35:26
That worked! Thanks!
2010-05-26 23:03:42
Gracias por el aporte
2010-05-27 14:39:53
Hi. I have a button when the user click on the button, the ajax call a method. This method, return a array and each elements must be set in differents text fields. How can i do it?
thanks.
2010-05-31 16:11:31
Thanks a lot, kvas!
I did not believe my eyes when I saw this actually working. I have had too much pain getting Prototype, Script.aculo.us & jQuery working nicely together, but this is a real solution. And a fast one too (much faster auto complete!). All my auto complete fields, ajax forms and such worked straight away!
2010-06-08 13:02:48
i m new to cakephp ......... i have problem with image uploading ... i used ajax helper, in comments i read about ajax file uploading helper , can you please give me link for ajax file uploading helper or little bit description about ajax file uploading helper...thanks .
2010-06-08 14:48:40
vinay, you can try with http://www.davidgolding.net/cakephp/ajax-file-uploading-with-cake-and-jquery.html
2010-07-01 13:53:22
hi...
Thanks a Lot ....
i update my jquery with jquery 1.2.2 as instruction given in link , it works but i got error in js file
f.offset is undefined
jquery-ui-1.8rc3.custom.min.js
2010-07-05 10:13:20
vinay , you should use more actual version than 1.2.2 (like 1.4.2)...
I didn't ever get this error, so I can't help you at this moment...
2010-07-06 15:48:25
Hi,
How can I change the charset of the ajax requests? I'm using de remoteTimer with 'contentType' => 'text/plain' but I would like to change the charset.
thanks.
2010-07-07 09:32:37
Hi Kvas, I was wondering if you can still use Prototype and script.aculo.us even after adding the jquery helper?
Thanks!
2010-07-16 10:27:10
Geidivan, I think that jQuery doesn't provide this feature. You can build callback method that will converse from one charset to the other.
Louie Miranda, no at this moment jQuery is not installed in compatibile mode...
2010-08-15 05:14:02
Hi Kvas,
I've been using your helper, fantastic stuff. Thank you!
Quick question, is there any way at all to support file upload? I notice you only allow "post" or "get" as form types currently.
Thanks! And any way I can help out with this project, let me know.
Eric
2010-08-15 23:13:59
Hi Eric,
I didn't try try to upload files by this helper yet, so at this moment I think it's not posibble :)
Maybe in future I'll add support for those features...
2010-08-16 05:49:42
Kvas,
I'm interested in helping you develop this functionality. Let me know when you are available to discuss. I've sent you my email via your contact form.
Thanks!
Eric
2010-08-29 14:05:20
Dobra robota, dzięki wielkie!
2010-09-09 20:12:08
Any chance in a datepicker, kvas? :)
2010-09-12 16:10:44
Hi Kvas & Thanx for this useful helper
but there is a problem with that when i use IE, <DIV> s don't show!!!!
Just tables and text shown!
"I cleared cache & ..."
2010-09-13 11:35:47
Hi
smiler: I'm working at this feature ATM.
cybercoder: few days ago I changed some css styles, maybe that was the problem...
2010-09-14 00:19:44
Supporting smiler comment,
A datePicker will be a nice methodo to add,
I'll be wating !!!!
And again, nice work
2010-09-14 19:35:57
This is the most amazing work i must say.
Now for a while i am working with cakephp and i am mixing prototype and jquery for my sites and i have to write noconflict here and there.
but i found this and really speaking this thing saved me from worrying to much about the conflict and all .
Thank You
2010-09-15 16:11:30
As I promised: new helper methods have arrived.
I know that most of them are User Interface method, but I don't want to create another helper to provide new functionalities.
Good news for gabrielr and smiler :) Datepicker inside!
If you find any bug or language mistake give me feedback here! Many thanks for help in testing new features.
2010-09-21 23:27:57
Yeah !! new methods have arrived !!!
Nice work, excellent Helper !!!
2010-09-30 14:32:44
Thanks for your helper, it was indeed of great help :)
2010-10-07 13:26:05
Hi kvas,
Do any of your functions assist in the dynamically auto populating of drop down boxes?
For example.. I select an option from dropdown box 1, and the options in dropdown box 2 and 3 are populated accordingly?
cheers,
2010-10-07 15:26:41
Hi smile,
No, but method from this helper you can't easly create drop down menu.
But you can try one of those examples:
http://www.1stwebdesigner.com/resources/38-jquery-and-css-drop-down-multi-level-menu-solutions/
2010-10-08 15:26:31
Thanks!
2010-10-08 16:59:25
kvas,
regarding dropdown textfields... the link help you have that calls content into a div.. I wasn to use that,but from a dropdown..
so dropdown form field has a few options and if I select one of those options, it calls your link function passing the option value... is that possible?
many thanks
2010-10-11 09:03:09
Hi smiler,
I don't know what you actually want to do so I can't help you. But if you're trying to make complex JavaScripts, I think you should use plain jquery (without helper).
2010-10-30 23:08:28
Hi Kvas,
Your helper is wonderful, can you help me to log Auth with Ajax ? do you have it already ?
2010-11-15 17:02:57
Hi,
How do I put the method codes to be inside a document ready function..?
<?=$ajax->tabs('tabs')?>
it's just producing the code
<script type="text/javascript">
//<![CDATA[
var tabs = $('#tabs').tabs({});
//]]>
</script>
it's resulting to javascript error $("#tabs").tabs is not a function
Am I missing something here?
thanks
2010-11-23 13:55:33
Hi cakephpcebu,
I think that there is no problem with 'ready' but with your javascript libraries. Check that you include jquery and jqueryui (with tabs).
@Adam: what kind of problem do you have?
2010-12-11 21:28:02
hi,
I just want to connect (login/pass) with ajax in cakephp.
2010-12-12 09:38:41
Hi Adam,
Try to wrote some code by your self and ask me if you have any problems...
2010-12-26 14:56:10
Hello Kvas,
It is possible to use the paginate method include in Cakephp for making ajax link with your helper ?
2010-12-28 17:06:53
Hi Jer,
I've never tried to do this functionality. You must check it on you own hand.
2010-12-28 20:53:18
Hi Kvas,
I was wondering if there is a "replace" option for position with Ajax->link? I want the returned content to replace the anchor element rather than be appended, etc.
Is this functionality available with your plug-in? Is there any other way to accomplish this?
Thanks!
Eric
2010-12-28 21:07:32
Hi Kvas,
Another quick question. Does this helper work with 'JQuery Live'? When I load content using an AJAX link, and in that content there is another ajax link that loads content, it seems to not work when I click it.
Thanks,
Eric
2010-12-28 22:25:50
Hi Eric,
Maybe you should try use 'update' parameter without 'position'. In this case response will be put into updated container and old containers content will be deleted.
At the time when I was writing this helper there were only 1.3.x version on jQuery, so .live() is not supported.
2011-01-04 14:40:11
I am getting the following error
Fatal error: Class 'Debugger' not found in /var/www/html/senthil/cakejq/cake/libs/debugger.php on line 252
2011-01-04 17:46:37
Hi senthil,
As you can see in error message it is problem with debugger. I don't know what are you doing wrong, but it isn't bug of helper.
2011-01-09 07:44:43
uchida from japan wrote:
2011-01-09 07:42:28
Thanks for your support so much.
I have some problem after settings of this one.
This remoteFunction doesn't work for my cakephp application.
I have an error like this.
-----------------------------
invalid XML markup
<?=$ajax->remoteFunction(
-----------------------------
Please help me and thanks in advance.
2011-01-09 09:32:41
Hi Uchida from Japan,
Maybe you don't have enabled short_open_tags in you php.ini
Try:
<?php echo $ajax->remoteFunction(
2011-01-10 01:39:12
Thanks for kvas.
It works.^^
I am a beginner of php.
Your effort is so great.
I really appreciate you again.
2011-03-08 09:39:41
Hello, the first, thank you for this helper.
Only one thing, when use resizable method with containment in firefox, fail because the call write
var draggable = $("#draggable").resizable({containment:#parentframe});
and containment need quotes.
it's all.
Bye
2011-03-08 18:01:35
Hi Arantxa,
Thanks for info. Bug is fixed now. You can download updated helper now.
2011-04-05 09:12:12
For example we have 2 submit buttons. Using Ajax->form how can i know which button is pressed? Thanks
2011-04-06 18:43:17
Hi Allanaire,
Using only my helper it's impossible. But you can write your own different javascript functions for click on submit.
2011-04-21 18:43:14
Hi there i am using the following code and i am getting only text with Open Dialog button. please help.
View File---------
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<button id="opener">Open Dialog</button>
<?=$ajax->dialog('dialog',array('autoOpen' => false))?>
<script type="text/javascript">
$(function() {
$('#opener').click(function() {
$('#dialog').dialog('open');
return false;
});
});
</script>
In my default.ctp i have lines
echo $html->css('jquery-ui-1.8.4.custom');
echo $this->Html->script('jquery-1.4.2.min.js');
echo $this->Html->script('jquery-ui-1.8.4.custom.min.js');
echo $this->Html->script('jquery.autocomplete.min.js');
echo $this->Html->script('jquery.jeditable.mini.js');
2011-04-21 18:48:40
Hi there i am using the following code and i am getting only text with Open Dialog button. please help.
View File---------
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<button id="opener">Open Dialog</button>
<?=$ajax->dialog('dialog',array('autoOpen' => false))?>
<script type="text/javascript">
$(function() {
$('#opener').click(function() {
$('#dialog').dialog('open');
return false;
});
});
</script>
In my default.ctp i have lines
echo $html->css('jquery-ui-1.8.4.custom');
echo $this->Html->script('jquery-1.4.2.min.js');
echo $this->Html->script('jquery-ui-1.8.4.custom.min.js');
echo $this->Html->script('jquery.autocomplete.min.js');
echo $this->Html->script('jquery.jeditable.mini.js');
2011-04-21 18:49:08
Hi there i am using the following code and i am getting only text with Open Dialog button. please help.
View File---------
<div id="dialog" title="Basic dialog">
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<button id="opener">Open Dialog</button>
<?=$ajax->dialog('dialog',array('autoOpen' => false))?>
<script type="text/javascript">
$(function() {
$('#opener').click(function() {
$('#dialog').dialog('open');
return false;
});
});
</script>
In my default.ctp i have lines
echo $html->css('jquery-ui-1.8.4.custom');
echo $this->Html->script('jquery-1.4.2.min.js');
echo $this->Html->script('jquery-ui-1.8.4.custom.min.js');
echo $this->Html->script('jquery.autocomplete.min.js');
echo $this->Html->script('jquery.jeditable.mini.js');
2011-04-30 07:45:33
I am new to cake.
Its really nice work done by the sweet person/persons.
Love you all.
2011-05-03 11:45:43
Please Specify briefly. step by step how to configure it in cakephp 1.3
2011-05-05 12:38:25
nice helper
2011-05-13 07:33:34
Thank you! Saved me a lot of time!
2011-05-16 05:36:25
Hi, I'm having a problem with "PeriodicalExecuter"
Firefox says: PeriodicalExecuter is not defined
why is this happening? actually, it is running on my localhost but when i test it on the server with an IP of 192.168.0.80/ then it says not defined. Someone please help.
Thanks a lot.
2011-05-16 07:34:32
Ooopppsss... please disregard my previous post. I already solved it. and i just forgot to add it on the SVN the js files.
This plugin is cool!
2011-05-20 17:30:49
I keep getting "Uncaught ReferenceError: Ajax is not defined". Any idea what I do wrong?
2011-05-21 10:16:57
Hi PelleP,
Maybe you not including jquery libs in your layout?
2011-05-25 22:46:58
actually I did... at least I got this line when I look at the source code:
<script type="text/javascript" src="/project/js/jquery-1.4.2.min.js"></script>
The problem seems to be that I can not use your helper. I would really like to get this to work since I think that the things you´ve done here is awesome.
2011-05-25 22:56:45
GOT IT! sorry for bothering you. I simply putted it in the wrong helpers folder. thanks for great work!
2011-06-16 03:29:18
appears to not work when called inside jquery.lightbox
any ideas?
2011-06-16 08:07:34
Hi Thumper,
I've never used this helper with jquery.lightbox so I can't help you...
2011-06-16 11:05:00
No worries, thanks for responding though :)
2011-07-08 06:47:20
you can share sourcode to me please!
2011-08-08 11:28:04
The Cake documentation says
"Migrating from CakePHP 1.2 to 1.3"
Deprecated Helpers
Both the JavascriptHelper and the AjaxHelper are deprecated, and the JsHelper + HtmlHelper should be used in their place.
http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3
Questions :
Is this advisable to use in version 1.3.x?
Will this really work?
Please help so i can decide what to use..
Thank you very much
By the way, nice plugin... ^_^
2011-08-08 17:02:39
Hi Bogs,
If cakePHP will not support old method I'll update my helper, so it's safe to use.
2011-08-09 04:04:44
Hi kvas,
Thank you, i really want to use this kind of helper... please let me know if you already updated this and it is safe to use... please send me an email.. vestil_v@yahoo.com...
Thanks a lot, keep it up ^_^
2011-08-09 07:48:22
Hi again Bogs,
You can use it now, When it will be updated it will be backwards compatible.
2011-08-10 03:56:21
hello kvas,
If i use it now , will the syntax not change after the update? is the way of coding ajax the same ?
because I read the Cake 1.3 and implemetation of ajax using JsHelper is different
(like this one)
$this->Js->get('#myID')->event->(.....)
thanks for the replies.
2011-08-10 07:47:36
Hi Bogs,
But many people is using this helper now, so when the syntax will be unchanged it'll be easier and faster to migrate.
2011-08-27 04:57:27
this supported in CakePHP2?
2011-08-29 08:37:19
Hi saleh,
I didn't have enough time to check it. When I do it I'll give info here.
2011-11-13 20:00:52
Hi
i have some problems using observeField
<?php
echo $ajax->observeField( 'ProductSubcategoryId',
array(
'url' => array( 'action' => 'get_products' ),
'update' => 'stock'
)
controller :
function get_products(){
$id = $this->data['Product']['subcategory_id'];
$this->set('products',
$this->Product->FindAllBySubcategoryId($id));
}
);
?>
2011-11-13 20:06:44
view :
<?php
if( !empty($products) ){
$purchase = ...;
$selling = ..;
echo "
<div>$purchase</div>
<div>$selling</div>";
}
?>
i'm getting all the page( html body footer) as a result of my request.
how can i get only the two divs ?.
2011-11-15 07:12:00
Hi knocking,
You should change layout for your controller to 'ajax'.
In cakephp 1.3 $this->layout('ajax');
2011-11-15 15:39:58
thank u
2011-11-17 06:45:17
Tnx.When release for cakephp 2.0
2011-11-22 08:50:11
Hi Kani,
In download section you can get new helper version compatible with CakePHP 2.0
2011-11-23 14:12:31
Congratulations for release this helpful helper for cakephp 2.0.
2011-11-24 14:30:57
:)
2011-11-24 14:32:04
Thank you very much
2011-11-28 22:55:45
Thank you Kvas for release cake 2.0, your work is wonderful !!
2011-12-27 08:13:07
Call to a member function link() on a non-object in D:\wamp\www\cakephp2\app\View\Helper\ajax.php on line 309.I got this error while running the in cakephp latest release.
2011-12-27 08:29:14
link is not working I think,remote function is working fine.
2011-12-28 18:45:21
Hi sanjib dhar,
Are you sure that you've downloaded helper for cake2.0 in download section?
2012-02-17 16:58:04
Adding this helper (or any helper) breaks my app. What am I doing wrong. I have CakePHP 2.0.6 and followed the instructions to a T, but when I have the line:
var $helpers = array('Javascript', 'Ajax'); in my AppController I get the following message when I reload the home page:
Fatal error: Call to a member function create() on a non-object in /Library/WebServer/mcn/app/View/Pages/home.ctp on line 35
Line 35 is where the following line of code is called:
<?php echo $this->Form->create('User', array('action' => 'login'));?>
2012-02-17 17:03:02
Never mind, I'm an idiot - I didn't realize I had to load the helpers that I never loaded before.
2012-02-27 22:11:02
Hi I'm unable to get the ajax helper to work with cakephp 2.0. I have it loaded correctly, and I don't get any errors. However if I try to do something simple like the following:
<p>Date: <input id="datepicker" type="text"></p>
<?php $this->Ajax->datepicker('datepicker')?>
I get nothing but an empty text box...?
I have:
echo $this->Html->script('jquery-1.7.1.min'); in my default.ctp file
public $helpers = array('Time', 'Js', 'Ajax'); in my controller
What's wrong?
2012-02-27 22:15:02
Hi I'm unable to get the ajax helper to work with cakephp 2.0. I have it loaded correctly, and I don't get any errors. However if I try to do something simple like the following:
<p>Date: <input id="datepicker" type="text"></p>
<?php $this->Ajax->datepicker('datepicker')?>
I get nothing but an empty text box...?
I have:
echo $this->Html->script('jquery-1.7.1.min'); in my default.ctp file
public $helpers = array('Time', 'Js', 'Ajax'); in my controller
What's wrong?
2012-02-29 00:36:11
Steven, try
public $helpers = array('Time', 'Javascript', 'Ajax');
I get a white screen of death whenever Ajax is loaded. Investigating.....
2012-03-20 04:42:20
I have error:
Fatal error: Call to a member function addScript() on a non-object in /var/www/projects/liber/app/View/Helper/JavascriptHelper.php on line 268
2012-03-20 05:02:07
Working for me:
//$view =& ClassRegistry::getObject('view');
$view = ClassRegistry::init('view');
2012-03-21 07:41:17
Hi Tobias,
From cake2.1 you should use $this->Html->script('jquery.min') in your layout file.
Btw the error you're getting suggest that your helper files aren't included properly.
2012-03-23 04:26:35
Kvas, thank you man! You are nice guy!
2012-03-28 12:27:03
First, thank you very much for your efforts. This helper does tho job!
Just one question, how can I validate for on Ajax submit bu using model validators.
Thanks
2012-04-09 18:29:44
Hello kvas,<br />
There is a problem for loading the Multibyte class. I have replaced App:import... by this :<br />
if (!class_exists('Multibyte')) { App::uses('Core','Multibyte');}<br />
(Javascript Helper - line 296)