internetarchive / internetarchive/openlibrary

Author not added to work if neither the pop-up author name, nor "Create a new record for" is selected on /books/add

Open
#6,980 2 comments 0 reactions 1 assignee Claimed by @akramcodez View on GitHub
Lead: @mekarpeles Priority: 2 Theme: Editing Type: Bug
Dominant language
Python
Stars
6.7k
Forks
2k
Avg merge
2d 19h
Merged PRs (30d)
138

Description

When entering a book via http://localhost:8080/books/add, the text entered into the "Author" field is only added to the book's record if the patron clicks on the pop-up for (1) the existing author name, if the author exists, or (2) "Create a new record for" if the author does not exist.

For people typing quickly or using tab on the keyboard to switch fields, it can be easy to overlook clicking on those, as nothing prevents one from entering an author name, *not* clicking one of the pop-ups, and then clicking "Add"; in this case the author entered in the author field will be absent from the work.

### Evidence / Screenshot (if possible)
#### Adding a new author fails without clicking one of the pop-ups in the author field

Adding a new book with a new author, without clicking on the pop-up to select an existing author or to create a new one:
![image](https://user-images.githubusercontent.com/26524678/191141723-38e5b89c-cdf0-4293-a27c-fedd63a31dd0.png)

With all the fields completed as above, the HTML for the form has not updated to include the author name, yet one can add the book, even with ``
![image](https://user-images.githubusercontent.com/26524678/191142152-edc33a50-6b21-470c-b569-8566c32caac1.png)

And it does not show up in the work:
![image](https://user-images.githubusercontent.com/26524678/191142184-bb7c04c2-7f76-4c45-9090-33cb3991d393.png)

But if his name is clicked, `input_id="author-0-key" ... value="/authors/OL18283A">` shows up:
![image](https://user-images.githubusercontent.com/26524678/191142269-0395f363-8242-4909-89b5-85811778f516.png)

### Relevant url?

http://localhost:8080/books/add or https://www.openlibrary.org/books/add

### Steps to Reproduce

1. http://localhost:8080/books/add
2. Add an existing or new author, but do not click a pop-up with the existing author name, or to create a new record.
3. Click "Add"
4. The "Author" field in the created work will be empty.

* Actual: The author in the author input box on /books/add is not added to the work.
* Expected: The author in the author input box on /books/add is added to the work.

### Details

- **Logged in (Y/N)?** Y
- **Browser type/version?** Firefox 103.0.2 (64-bit)
- **Operating system?** Manjaro: 5.19.1-3-MANJARO
- **Environment (prod/dev/local)?** dev

### Proposal & Constraints

I propose there be some sort of constraint (along with visual feedback about what's wrong) that prevents a patron from both filling out the author field and clicking "Add" on /books/new without also clicking the pop-up to either create a record for an author or to select an existing author.

### Related files

### Stakeholders

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.