0
최신 (2.1.1) 버전의 cakePhp를 사용하고 있습니다. ajaxHlper (http://www.cakephp.4uk.pl/)를 구현하려고했습니다. 그러나 사이에 붙어. Cakephp 2.1 - AjaxHelper
<head>
<script type="text/javascript">
$(document).ready(function(){
$("#EmployeeAddForm").validate();
});
</script>
</head>
<div class="employees form">
<?php echo $this->Form->create('Employee');?>
<fieldset>
<legend><?php echo __('Add Employee'); ?></legend>
<?php
echo $this->Form->input('first_name');
echo $this->Form->input('last_name');
//echo $this->Form->input('age');
echo $this->Form->input('age', array('class' => 'required number'));
echo $this->Form->input('sex');
echo $this->Form->input('Adress.first_line');
echo $this->Form->input('Adress.second_line');
echo $this->Form->input('Adress.city');
echo $this->Form->input('Adress.state');
echo $ajax->autoComplete('Department.name', '/ajax/autoComplete')
?>
</fieldset>
<?php echo $this->Form->end(__('Submit'));?>
</div>
<div class="actions">
<h3><?php echo __('Actions'); ?></h3>
<ul>
<li><?php echo $this->Html->link(__('List Employees'), array('action' => 'index'));?></li>
<li><?php echo $this->Html->link(__('List Adresses'), array('controller' => 'adresses', 'action' => 'index')); ?> </li>
<li><?php echo $this->Html->link(__('New Adress'), array('controller' => 'adresses', 'action' => 'add')); ?> </li>
</ul>
이 Department.name 내가 ajaxHelper를 사용하여 자동 완성하려고 내 add.ctp 파일입니다
. 내 EmployeesController.php에서나는 그것은 작동하지
function autoComplete() {
echo $this->params['url']['q'] . "---";
$this->loadModel("Department");
$this->set('departments', $this->Department->find('all', array(
'conditions' => array(
'Department.name LIKE ' => '%'.$this->params['url']['q'].'%'
),
'limit' => $this->params['url']['limit'],
'fields' => array('name')
)));
$this->layout = 'ajax';
}
처럼 자동 완성 기능을 가지고있다. 내가 뭘하고있는 실수 일 수 있니? 그 날 같은 오류를 범 :
고지 (8) : 미정 변수를 AJAX [APP \보기 \ 종업원 \의 add.ctp, 라인 84] 치명적인 오류 (멤버 함수 자동 완성 호출) 비 온 -object C에서 : \ xampplite \ htdocs에 CakePHP의 \ \ 응용 프로그램, 당신과 함께 도우미에 액세스 할 수는 컨트롤러의 $helpers
배열에 도우미를 추가 한 가정 라인 (84)