Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

insert_rows keypress Enter behavior #14401

Closed
kampalex opened this issue Jun 17, 2018 · 5 comments
Closed

insert_rows keypress Enter behavior #14401

kampalex opened this issue Jun 17, 2018 · 5 comments
Assignees
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Milestone

Comments

@kampalex
Copy link
Contributor

Steps to reproduce

  1. Select table in database overview
  2. Choose table record insertion
  3. On the bottom, insert different number of record to insert (like 6), press [Enter] instead of clicking outside this input:number (id=insert_rows)

Expected behaviour

In-page extension of insertable records, like the blur event

Actual behaviour

Message shows: 'No databases selected'
Click on table name (at top)
Message appears:
Notice in ./libraries/db_table_exists.inc.php#20
Undefined variable: db

Backtrace

./tbl_change.php#25: require_once(./libraries/db_table_exists.inc.php)
./libraries/classes/InsertEdit.php#2147: include(./tbl_change.php)
./tbl_replace.php#55: PhpMyAdmin\InsertEdit->isInsertRow()

Click on table again and issue disappears

Server/Client configuration

Ubuntu 18.04
Apache/2.4.29
MariaDB 10.1.29
PHP 7.2.5
phpMyAdmin 4.8.1
Google Chrome 69.0.3452.0 dev x64

@aroralakshya
Copy link
Contributor

Have you tried defocusing that textbox?? It works. Maybe it shouldn't or maybe they have made it that way, if yes, then the action on pressing enter could be disabled. OR action on defocusing could be disabled and it will work only on pressing enter.

@kampalex
Copy link
Contributor Author

As said I defocused (which triggers the blur event) the field, which gives me the extra record insertions.
I suggest an event listener 'keydown', on [Enter] key it will trigger the blur event, but only if the field does contain a valid number.

@williamdes williamdes added the Bug A problem or regression with an existing feature label Nov 27, 2018
@williamdes
Copy link
Member

@kampalex I had this issue !

NOTICE: PHP message: PHP Fatal error:  Uncaught TypeError: strlen() expects parameter 1 to be string, null given in /mnt/Dev/phpmyadmintest/libraries/db_table_exists.inc.php:21
Stack trace:
#0 /mnt/Dev/phpmyadmintest/tbl_change.php(27): require_once()
#1 /mnt/Dev/phpmyadmintest/libraries/classes/InsertEdit.php(2165): include('/mnt/Dev/phpmya...')
#2 /mnt/Dev/phpmyadmintest/tbl_replace.php(58): PhpMyAdmin\InsertEdit->isInsertRow()
#3 {main}
  thrown in /mnt/Dev/phpmyadmintest/libraries/db_table_exists.inc.php on line 21

@kampalex
Copy link
Contributor Author

kampalex commented Dec 3, 2018

Issue still appears in PMA 4.8.3 (under PHP 7.2.12).

...dived into it

@williamdes This is probably because of missing 'global $db;' (or not used $GLOBALS['db'] as used in other files, or it doesn't exists yet) in db_table_exists.inc.php. But when I global it, it does (in this issue) lead to more failures due to missing table variable. When also declaring table as global, more issues occur due expected variables. Stopped there...

I still suggest to implement the already provided mentioned 'JS [Enter] triggers keypress' for this field. Fixing in PHP costs more efforts (but maybe this can be a kind of treasure hunt for more bugs/unwanted behavior).

Origin of issue is 'different input value of insert_rows', which includes the 'tbl_change.php' file.

saurass added a commit to saurass/phpmyadmin that referenced this issue Apr 12, 2019
…event to ENTER key on add new field

Signed-off-by: Saurabh Srivastava <saurabhsrivastava312@gmail.com>
@williamdes williamdes added the has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete label Apr 12, 2019
@williamdes williamdes self-assigned this Apr 28, 2019
@williamdes williamdes added this to the 4.8.6 milestone Apr 28, 2019
williamdes added a commit that referenced this issue Apr 28, 2019
Signed-off-by: William Desportes <williamdes@wdes.fr>
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A problem or regression with an existing feature has-pr An issue that has a pull request pending that may fix this issue. The pull request may be incomplete
Projects
None yet
Development

No branches or pull requests

3 participants