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

Submitting form with "Enter" creates two records #173

Closed
romaninsh opened this issue Jun 4, 2017 · 5 comments
Closed

Submitting form with "Enter" creates two records #173

romaninsh opened this issue Jun 4, 2017 · 5 comments

Comments

@romaninsh
Copy link
Member

romaninsh commented Jun 4, 2017

After much testing, I noticed that the problem ONLY OCCURS if there is a single field in a form.

require 'vendor/autoload.php';

class Brand extends \atk4\data\Model {
    public $table = 'brand';

    function init()
    {
        parent::init();

        $this->addField('name');
        $this->addField('producer');   // comment this out and it stops working!
    }
}

$db = new \atk4\data\Persistence_SQL('mysql:host=127.0.0.1;dbname=warehouse;charset=utf8', 'root', 'root');

$g = $layout->add(['CRUD']);
$g->setModel(new Brand($db));

Two requests are sent to the backend:

screen shot 2017-06-24 at 16 32 56

and

screen shot 2017-06-24 at 16 33 21

With two fields only one request is sent:

screen shot 2017-06-24 at 16 34 30

MAYBE it's because of error 500 ?

@romaninsh
Copy link
Member Author

romaninsh commented Jun 24, 2017

Were able to find out exact cause.

@DarkSide666
Copy link
Member

DarkSide666 commented Jun 24, 2017

It's because of how browser treats 1 field forms nad HTML 2.0 specification.
Some browsers send submit when you press Enter in 1-field form, but some doesn't.

Some reading:
https://stackoverflow.com/a/1370314/1466341
https://stackoverflow.com/a/39603896/1466341
https://stackoverflow.com/a/17797230/1466341

@romaninsh
Copy link
Member Author

romaninsh commented Jun 25, 2017

this native submit should be disabled, because i think the second action is sent through correctly but the frontend simply ignore that.

ibelar added a commit to ibelar/ui that referenced this issue Jun 30, 2017
update webpack configuration and js plugin file so it does not include
semantic-ui-modal in final bundle.
@acicovic
Copy link
Collaborator

acicovic commented May 31, 2019

Hasn't this been solved?
If yes let's close the issue.

@DarkSide666
Copy link
Member

This should be solved now by #379.
If problem will reappear then we can always create new github issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants