0

我想要一个元素内容作为我的 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();

所以它给了我与缺少表单助手相关的错误,所以任何人都可以帮助我如何使用这个外部对象添加表单助手?

更新:错误消息:

   $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
4

1 回答 1

0

你有没有

public $helpers = array('Form');

在您的控制器中?

于 2012-03-21T06:07:56.277 回答