Skip to content

Critical: Checkbox keeps set even if unset/unchecked #902

@mvorisek

Description

@mvorisek

Test code:

<?php

require __DIR__ . '/vendor/autoload.php';

$app = new \atk4\ui\App('My App');
$app->initLayout('Admin');

/* @var $form \atk4\ui\Form */
$form = $app->add('Form');
$form->addField('purge_missing', ['CheckBox']);
$form->buttonSave->set('Import');

$form->onSubmit(function(\atk4\ui\Form $form) {
    throw new \Exception($form->model['purge_missing']);
});

If the form is just send, the $form->model['purge_missing'] evaluates to 0. Fine.

But if the checkbox is checked, form is sent, and then unchecked and submitted again, the value is read as 1!

Please reproduce and fix asap.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions