2012-03-21 122 views
0

我想在我的ajax響應中使用一個元素作爲字符串。cakePHP 1.3:使用Ajax呈現問題

,所以我已經把下面的代碼在我的控制器行動

$view = new View($this, false); 
$view->viewPath = 'elements/private_challenge/';    
$res = $view->render('supporters_list_supporter'); 

現在我supporters_list_supporter.ctp我已經把如下一種形式:

echo $this->Form->create('RequestFrHelpReply',array('action'=>'add_helpreq_reply','class'=>'form','id' => 'helprequestreplyaddfrm','name'=>'helprequestreplyaddfrm')); 

echo $this->Form->hidden('PrivateChallengeRequestHelp.ReqID',array('value'=>$supporterlist['RequestFrHelp']['REQID'])); 
echo "<div class='alignleft'>"; 
echo $this->Form->input('PrivateChallengeRequestHelp.txt_helpreq_reply', array('label'=>false,'type' => 'textarea', 'id'=>'txt_helpreq_reply','escape' => false, 'div' => false, "class"=>"textarea request-help-textarea",'onKeyDown'=>'textCounterComment(this.form.txt_helpreq_reply,this.form.remLenth,'.Configure::read('CommentSetting.comment_body_max_limit').',\'remLenthDiv\');', 'onKeyUp'=>'textCounterComment(this.form.txt_helpreq_reply,this.form.remLenth,'.Configure::read('CommentSetting.comment_body_max_limit').',\'remLenthDiv\');')); 
    echo "</div>"; 
    echo '<span class="request-arrow"></span><span class="user-name"> : '.$html->get_users_username($session->read('Auth.User.id')).'</span>'; 
echo $html->link(__l('Reply'),'#',array('id'=>'helpreq_reply_link','class'=>'request-help-button alignleft','title'=>__l('Reply'),'escape'=>false,'onclick'=>'helpreq_reply(\'reply\');return false;'));    
echo "</div>";  
echo $this->Form->end(); 

因此,它給我的錯誤有關形式助手失蹤,所以任何人都可以幫助我如何添加形式助手這個exetrnal對象?

更新:錯誤消息:

$view = stdClass 
    stdClass::$modelScope = false 
    stdClass::$entityPath = "RequestFrHelpReply."</pre><pre class="stack-trace">Helper::setEntity() - CORE\cake\libs\view\helper.php, line 422 
    FormHelper::create() - CORE\cake\libs\view\helpers\form.php, line 217 
    include - APP\views\elements\private_challenge\help_request_form.ctp, line 21 

回答

0

你有

public $helpers = array('Form');

在控制器

+0

是的,我已經把它放在AppController的。 – chetanspeed511987 2012-03-21 06:10:11

+0

可以將錯誤信息完全粘貼到您的screeN上嗎​​? – 2012-03-21 06:10:49

+0

請檢查我的更新:錯誤消息: – chetanspeed511987 2012-03-21 06:35:31