This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

oskar.villani40843
oskar.villani40843

Hi,

I'm wondering how to solve this riddle: To make explanation more easy let's assume I have two tables named 'books' and 'author', where one author is able to 'hasMany' books written.

In an 'author' form it is easy to display the list of books written by an author via a partial. This partial gives also the opportunity to add a new book, not yet stored in the 'books' table.

The other way round in the 'books' table by creating a new book record the author can be selected by a record finder. But only already stored authors can be choosen!

Now the riddle: Is there a way to add a new author directly from the 'books' form via record finder (or anything else) using a popup form like it is possible to do that the other way round?

Thanks in advance!

Last updated

daftspunky
daftspunky

Hello, yes this is indeed possible, using the Relation Controller and the has one type, where book has one author.

The test plugin also has an example of this. Where a person has a phone number.

  1. Install Test plugin to plugins/october/test
  2. Click People, select a person
  3. Click Relation Controller

Here you can Create a new Phone (Author) or Link to an Existing Phone (Author)

Hope this helps

oskar.villani40843
oskar.villani40843

Oh my goodness, I have the test plugin already installed, but did not find the solution quite in front of my eyes :O.

Thanks so much, helps a lot, I will study this!

Best regards
Oskar

1-3 of 3

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.