Crud: [4.1.x][Bug] InlineCreate - Submit with Enter without button focus results in 405 error

Created on 19 May 2020  路  3Comments  路  Source: Laravel-Backpack/CRUD

Bug report

What I did

When using the inline create operation to add a new entity (a tag), I hit enter with the text input field focused.

What I expected to happen

The same behavior when clicking "Save": The modal would close, and the new tag would be selected for the relationship field.

What happened

I received a 405 error, stating that the post method was not allowed (see below).

image

I reproduced this in the Backpack Demo with the following steps:

  • Under Demo Entities, select Monster.
  • Edit the first item.
  • Navigate to the Relationships tab of the item in question.
  • For the field labeled "Relationship (no AJAX; also uses InlineCreate) ", click the + Add button.
  • Enter anything into the text input.
  • Hit enter.

You then get the 405 page, with the URL below:

https://demo.backpackforlaravel.com/admin/monster/140/edit#

What I've already tried to fix it

I checked the steps in the Inline Creation documentation to make sure I was following them appropriately. No other modifications at this time.

(In the short term I'll be looking to just disable the default behavior here so that doesn't submit, but the ideal case would be maintaining the user of enter to submit for quick creation.)

Backpack, Laravel, PHP, DB version

When I run php artisan backpack:version the output is:

PHP VERSION:

PHP 7.3.14 (cli) (built: Jan 24 2020 03:06:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.14, Copyright (c) 1998-2018 Zend Technologies
with Zend OPcache v7.3.14, Copyright (c) 1999-2018, by Zend Technologies

LARAVEL VERSION:

v7.11.0@f4563bd2e0875c59a1f7967abdbe5cef7f240117

BACKPACK VERSION:

4.1.5@e2c166b065f6b405747db5a5f4d36a2a88f8dc22

Bug

All 3 comments

Hello there! Thanks for opening your first issue on this repo!

Just a heads-up: Here at Backpack we use Github Issues only for tracking bugs. Talk about new features is also acceptable. This helps _a lot_ in keeping our focus on improving Backpack. If you issue is not a bug/feature, please help us out by closing the issue yourself and posting in the appropriate medium (see below). If you're not sure where it fits, it's ok, a community member will probably reply to help you with that.

Backpack communication channels:

  • Bug Reports, Feature Requests - Github Issues (here);
  • Quick help (_How do I do X_) - Gitter Chatroom;
  • Long questions (_I have done X and Y and it won't do Z wtf_) - Stackoverflow, using the backpack-for-laravel tag;
  • Showing off something you've made, asking for opinion on Backpack/Laravel matters - Reddit;

Please keep in mind Backpack offers no official / paid support. Whatever help you receive here, on Gitter, Slack or Stackoverflow is thanks to our awesome _awesome_ community members, who give up some of their time to help their peers. If you want to join our community, just start pitching in. We take pride in being a welcoming bunch.

Thank you!

--
Justin Case
The Backpack Robot

Hello @GenericHero01

Thanks for spotting this. I could confirm this is happening, but stange, only happen if you don't have the button focused.

If you "TAB" until you reach the save button and hit enter, everything works as expected.

Also in "Inline Create" for product Relationship (also uses InlineCreate; Fetch using AJAX) if you hit enter nothing will happen.

My guess is that the problem relies on having the button for the icon in the inline create modal.

I will give it a go let you guys know my findings.

I've just merged and tagged @pxpm 's PR #2855 which fixes this. Thanks a lot guys!

Was this page helpful?
0 / 5 - 0 ratings