2

is it possible to have a onepage-form for editing or creating a entry and its related (1 to n) entrys?

For example: I have a customer model, every customer can have unlimited addresses. I could now have a CustomerCrudController and a AdressCrudController with the adress having select2-field for the customer, maybe having some kind of filter for the customer in the adress-list-view but it would be a more fluid working having the ability to change or add adresses in the customers-edit-view.

Thanks Christin

4

1 に答える 1

1

現在、Backpack CRUD 作成/編集フォームでこれを行う組み込みの方法はありません。これは計画されていますが、Backpack の次のバージョンまでは実行されません。リリースまでに 3 ~ 6 か月かかる可能性があります。

あなたができることは次のとおりです。

1)独自のカスタム フィールド タイプを作成します。たとえば、「select_or_create_address」とします。

2) select2 フィールド タイプから開始し、カスタム機能を作成します。

  • 結果はajaxでロードできます。
  • 選択の横にあるボタンは、次のいずれかの住所作成フォームを含むポップアップを開くことができます。
    • データベースに新しいアドレスを挿入する、自分でコーディングする簡単なフォーム。
    • AddressCrudController 作成フォーム (ただし、メニュー、サイドバーなどはありません); このためには、AddressCrudController に別のメソッドを作成する必要があります。CrudController::create() に基づいていますが、別のビューをロードします。
  • アドレスが正常に追加されたら、id を select2 に値として挿入する必要があります。

クイック フォームを使用することをお勧めします。クイック フォームの方が開発が速く、iFrame ポップアップなどのソリューションに頼る必要はありません。

乾杯!

于 2016-11-04T09:16:44.120 に答える