Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6853041
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:27:49+00:00 2026-05-27T01:27:49+00:00

Say I have Author and Book domain classes (one Author has many Books ).

  • 0

Say I have Author and Book domain classes (one Author has many Books). The user goes to book/create to enter the details for a new Book. One of the fields in the form is a select with all Author instances in the database, but this Book belongs to an Author who is not in the database.

What is the best way to implement the interface to add a new Author in grails, but keep the whole process relatively painless for the user? This is what I am thinking:

  • add Author fields to Book create view in a hidden div
  • add a link which will show the above mentioned fields and a save button
  • post the Author fields via Ajax to save them
  • update the author select to include the newly created Author
  • auto select the new Author in the select

I will work, but it seems a bit of a nasty approach (hacking the Book create view with non-Book fields). Is there a nicer way?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T01:27:50+00:00Added an answer on May 27, 2026 at 1:27 am

    I don’t think placing non-book fields in Book view is nasty.

    What I don’t understand is the need for separate Ajax call to save new Author – why not do this in the same action that the book is created in? If user chose an existing Author, set up the book as usually. If not, retrieve the author field values, create new Author instance, save it and then set book’s author field to it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Let say I have 3 tables: Book , Author and BookAuthor . Book has
So basically I have two classes, Book and Author . Books can have multiple
In my Grails app I have a couple of domain classes, say Author and
Say I have two tables, author and book. Each author can have multiple books,
Say that I have two classes called Book and Library as follow: var Book
Hypothetical scenario: I have two models: Author and Book . The Book model has
I have two models books and authors joined by books_authors model. A book has
Let's say I have an entity Author which has a name can write 0
I have a data structure which has, <Book title>, <Author>, and <rate> Since Book
Let's say I have books, each belonging to an author. I'd like to print

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.