0

两张图。问题往下看。

在此处输入图像描述

在此处输入图像描述

我的模板中确实有以下代码 - 再次非常感谢 j0k:

<div id="listdiv">
echo jq_form_remote_tag(array(
    'update' => 'listdiv',
    'url' => 'shoppinglist/update',
    'loading' => jq_visual_effect('fadeIn', '#indicator'),
    'complete' => jq_visual_effect('fadeOut', '#indicator'),
));
</form>
</div>

当我在空白字段中输入“apple”并提交表单(第一张图片)时,所有内容都将正确保存在数据库中。结果如图二。但是新领域没有出现。任何想法?

如果我进行完全刷新,番茄、苹果和一个新的文本字段会正确显示!

我关闭了 action.class.php 中的所有 if-method-GET/POST 语句。有人有想法吗?

更新

动作类.php

public function executeIndex(sfWebRequest $request) {
$endkunde_id = $this->getUser()->getAttribute('id');
$zustand_id = 1;

$list_id = 252;
$shopname_id = 1;
$shopname = 'shop 1';

// if ($this->getRequest()->getMethod() == sfRequest::GET) {
    $this->form = new YourListForm(array(), array('endkunde_id' => $endkunde_id, 'list_id' => $list_id));
    $this->form2 = new AddOnYourListForm(array('shopname' => $shopname), array('endkunde_id' => $endkunde_id, 'list_id' => $list_id, 'shopname_id' => $shopname_id));
//  }

}

public function executeUpdate(sfWebRequest $request) {
$endkunde_id = $this->getUser()->getAttribute('id');
$zustand_id = 1;

$list_id = 252;
$shopname_id = 1;
$shopname = 'shop 1';

    $this->addon_listForm = new AddOnYourListForm();
    $addonlist = array();

    $p = 'addon_list_id_';
    $q = (string) 252;
    $p .= $q;

    $this->addon_listForm->bind($request->getParameter($p));
    if ($this->addon_listForm->isValid()) {
        $formData = $this->addon_listForm->getValues();
        // $this->addon_listForm->save();
    }

    $this->form = new YourListForm(array(), array('list_id' => $list_id, 'endkunde_id' => $endkunde_id));
    $p = 'yourlist_';
    $q = (string) 252;
    $p .=$q;

    $this->form->bind($request->getParameter($p));
    if ($this->form->isValid()) {
        $this->form->save();
        $this->form = new YourListForm(array(), array('list_id' => $list_id, 'endkunde_id' => $endkunde_id));
    }
}
4

1 回答 1

0

我有一个解决方案:

简短说明:

action.class.php:

executeIndex{
if (method = post) {
 //handle the data
}
//here my index code above without method GET!!
}
于 2012-08-01T18:53:07.887 回答