Cakephp Autocomplete Tutorial ajax error

2015-01-31 Thread ajt




In CakePHP, I am trying to create a autocomplete function from a textbox, 
using this tutorial: http:
//bakery.cakephp.org/articles/matt_1/2011/08/07/yet_another_jquery_autocomplete_helper_2


I keep getting a

Undefined index: autoCompleteText


I solved the helper issue as it finds the helper as this is cakephp 1.X 
code and I have 2.X


controller - Tests
function auto_complete



class TestsController extends AppController {

public $helpers = array('Html', 'Form', 'Session','Js','AutoComplete');

 public function auto_complete() {
 $this->loadModel('Tutor');
 debug( $this->params);


$terms = $this->Tutor->find('all', array(
'conditions' => array(
'Tutor.first_name LIKE' => 
$this->params['url']['autoCompleteText'].'%'
),
'fields' => array('Tutor.first_name'),
'limit' => 3,
'recursive'=>-1,
));
$terms = Set::Extract($terms,'{n}.Tutor.first_name');
$this->set('terms', $terms);
$this->layout = '';
} 



view
 auto_complete.ctp


AutoComplete->input(
'Tutor.first_name',
array(
'autoCompleteUrl'=>$this->Html->url( 
array(
'controller'=>'tests',
'action'=>'auto_complete',
)
),
'autoCompleteRequestItem'=>'autoCompleteText',
)
);

  if(isset($terms)) {
echo $this->Js->object($terms);
  }

   echo $this->Form->create('');

echo $this->Form->input('type', array('label' => 'Choose' ));
   echo $this->Form->end('send'); 

 ?>



-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


CakePHP autocomplete tutorial ajax error

2015-01-31 Thread ajt


Hi,

In CakePHP, I am trying to create a autocomplete function from a textbox, 
using this tutorial: 
http://bakery.cakephp.org/articles/matt_1/2011/08/07/yet_another_jquery_autocomplete_helper_2

I keep getting a Error: AutoCompleteHelper could not be found. Undefined 
index: autoCompleteText

I am unsure how to fix this as I have tried relocating the files and still 
the same error.

I create the below files and copy the code from the tutorial, create the 
auto_complete.php in the view/helpers directory, and create 
webroot/js/views/helpers/auto_complete.js.

controller - Tests function auto_complete

class TestsController extends AppController {

public $helpers = array('Html', 'Form', 'Session','Js','AutoComplete');

 public function auto_complete() {
 $this->loadModel('Tutor');
 debug( $this->params);


$terms = $this->Tutor->find('all', array(
'conditions' => array(
'Tutor.first_name LIKE' => 
$this->params['url']['autoCompleteText'].'%'
),
'fields' => array('Tutor.first_name'),
'limit' => 3,
'recursive'=>-1,
));
$terms = Set::Extract($terms,'{n}.Tutor.first_name');
$this->set('terms', $terms);
$this->layout = '';
} 



view
 auto_complete.ctp


AutoComplete->input(
'Tutor.first_name',
array(
'autoCompleteUrl'=>$this->Html->url( 
array(
'controller'=>'tests',
'action'=>'auto_complete',
)
),
'autoCompleteRequestItem'=>'autoCompleteText',
)
);

  if(isset($terms)) {
echo $this->Js->object($terms);
  }

   echo $this->Form->create('');

echo $this->Form->input('type', array('label' => 'Choose' ));
   echo $this->Form->end('send'); 

 ?>




-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: cant get autocomplete function to find helper class

2015-01-31 Thread ajt
I checked the docs and the autocomplete tutorial is for cakephp 1.X 

To use it for cakephp 2.X I couldnt get it to work so I am stuck


-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.


Re: 3.0 - Cakephp plugins gone from /plugins

2015-01-31 Thread Joe T.
SOLVED:
Somewhere along the line, Congfigure::load() was changed to OMIT the ".php" 
file extension from config files. So Configure::load('app.php') is no 
longer correct, instead requiring Configure::load('app')

i'm not sure when that change was made, why Configure thinks i'm trying to 
load a Plugin when i use the ".php" extension, or how i got along until now 
with the old way working, but the site is finally loading again.

-joe

PS: Looking through Core/Configure, i noticed my IDE detected an undefined 
$config variable in Configure::version()...


On Wednesday, 28 January 2015 04:10:46 UTC-5, José Lorenzo wrote:
>
> The plugins that are installed by composer are not (correctly) put inside 
> vendor. Your own baked plugins can stay in ./plugins
>
> The error you are having seems to be that you are trying to load a plugin 
> called app somewhere. Try looking at the stacktrace of the error. Install 
> the php xdebug extension, that should help.
>
> On Wednesday, January 28, 2015 at 3:14:02 AM UTC+1, Joe T. wrote:
>>
>> i recently did a *composer update* for my dev site, and all the Cake 
>> plugins that were under /plugins were removed:
>>
>> /plugins
>> - /Bake   (gone)
>> - /DebugKit   (gone)
>> - /Migrations (gone)
>>
>> However, there are new(?) directories under /vendor/cakephp corresponding 
>> to the same plugins:
>>
>> /vendor/cakephp
>> - /bake
>> - /debug_kit
>> - /migrations
>>
>> i've tried deleting everything in /plugins & /vendor and the 
>> composer.lock file, then running *composer install* to get a fresh copy 
>> of everything, with no luck. i added the line to "scripts" as mentioned in 
>> the RC1 release notes and prescribed by the composer update message when i 
>> ran without it... If i'm missing some step with composer, i wouldn't be 
>> surprised, but i have no idea what it might be.
>>
>> My composer.json requires & such:
>>   "require": {
>> "php": ">=5.4.19",
>> "cakephp/cakephp": "3.0.*-dev",
>> "cakephp/plugin-installer": "dev-master",
>> "zurb/foundation": "dev-master",
>> "jockmac22/foundation_calendar_date_time_picker": "*",
>> "ckeditor/ckeditor": "dev-standard/latest",
>> "tecnick.com/tcpdf": "dev-master",
>> "openwall/phpass": "*"
>>   },
>>   "require-dev": {
>> "cakephp/bake": "dev-master",
>> "cakephp/debug_kit": "3.0.*-dev",
>> "cakephp/migrations": "dev-master",
>> "d11wtq/boris": "1.0.*"
>>   },
>>   "autoload": {
>> "psr-4": {
>>   "App\\": "App",
>>   "App\\Test\\": "Test",
>>   "": "./plugins",
>>   "Thook\\": "./plugins/Thook/src",
>>   "Thook\\Cakerov\\": "./plugins/Thook/Cakerov/src",
>>   "Thook\\Websites\\": "./plugins/Thook/Websites/src",
>>   "Thook\\Test\\": "./plugins/Thook/tests"
>> }
>>   },
>>   "autoload-dev": {
>> "psr-4": {
>>   "Thook\\Cakerov\\Test\\": "./Plugin/Thook/Cakerov/tests",
>>   "Thook\\Websites\\Test\\": "./Plugin/Thook/Websites/tests"
>> }
>>   },
>>   "scripts": {
>> "post-install-cmd": "App\\Console\\Installer::postInstall",
>> "post-autoload-dump": 
>> "Cake\\Composer\\Installer\\PluginInstaller::postAutoloadDump"
>>   },
>>
>>
>> Yeah, yeah, i know, silly names... 
>> Since this has happened, my dev site is completely broken. This is what 
>> appears on every page:
>>
>> *Plugin app could not be found.*
>>
>> No line number, file, or anything indicating what the problem is, and i'm 
>> pretty sure "app" isn't a plugin. It's thrown by (semi-obviously) 
>> MissingPluginException, and i see references to that in the Plugin loader 
>> (also somewhat obvious)... So what plugin is failing to load that 
>> identifies itself as "app", and is it related to the missing directories 
>> under /plugins? If so, why did they disappear, how do i get them back, or 
>> change my config to find them, etc.?
>>
>> If i seem cross, i apologize. i'm not frustrated with Cake itself, so 
>> much as my project & being too busy to immerse myself in learning the 
>> framework. 
>> Code available here: https://bitbucket.org/cautionbug/kodiak-investments
>>
>> Any help is truly appreciated.
>> -joe
>>
>>
>>

-- 
Like Us on FaceBook https://www.facebook.com/CakePHP
Find us on Twitter http://twitter.com/CakePHP

--- 
You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to cake-php+unsubscr...@googlegroups.com.
To post to this group, send email to cake-php@googlegroups.com.
Visit this group at http://groups.google.com/group/cake-php.
For more options, visit https://groups.google.com/d/optout.