0

2枚の写真。問題は下を見てください。

ここに画像の説明を入力してください

ここに画像の説明を入力してください

テンプレートには次のコードが含まれています-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」と入力してフォーム(最初の画像)を送信すると、すべてが正しくデータベースに保存されます。結果は写真2です。しかし、新しいフィールドは表示されません。何か案が?

完全に更新すると、トマト、リンゴ、新しいテキストフィールドが正しく表示されます。

action.class.phpのすべてのif-method-GET/POSTステートメントをオフにしました。誰かアイデアがありますか?

アップデート

action.class.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

私は1つの解決策を得ました:

簡単な説明:

action.class.php:

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