Project

General

Profile

Actions

Bug #6124

closed

Dynamic Update -- requiring and storing wrong fields

Added by Nicola Chiapolini almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
31.05.2018
Due date:
% Done:

0%

Estimated time:
Discuss:
Prio Planung:
Vote:

Description

I see two probably related bugs when a field is dynamically activated. (SQL-Code for my test setup below):

  1. A field that gets hidden by after a dynamic update is still saved to the database on submit.
  2. The mode "required" is always used from the form load, even if it changes by dynamic updates: (load stays required even if mode changes to hidden by a dynamic update and if a different field switches to required it can still be empty.)

Scenarios in my test setup:

  • Load form -> toggle checkbox -> fill Varcchar -> submit => IS Warning "Form incomplete" / SHOULD Saves Varchar + defaults from DB for other fields
  • Load form -> toggle checkbox -> fill Varcchar -> toggle checkbox -> fill Int -> submit => IS both int and varchar saved / SHOULD only int is saved, varchar uses default from DB

When replacing required with show for field1_int:

  • Load form -> toggle checkbox -> submit => IS saved with default values from db / SHOULD Warning "Form incomplete" raised

Table

CREATE TABLE `test_table` (
  `id` int(11) NOT NULL,
  `field1_int` int(11) NOT NULL,
  `field2_varchar` varchar(100) NOT NULL,
  `field3_datetime` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;

Form*

INSERT INTO `Form` (`id`, `name`, `title`, `noteInternal`, `tableName`, `permitNew`, `permitEdit`, `escapeTypeDefault`, `render`, `requiredParameterNew`, `requiredParameterEdit`, `dirtyMode`, `showButton`, `multiMode`, `multiSql`, `multiDetailForm`, `multiDetailFormParameter`, `forwardMode`, `forwardPage`, `bsLabelColumns`, `bsInputColumns`, `bsNoteColumns`, `parameter`, `parameterLanguageA`, `parameterLanguageB`, `parameterLanguageC`, `parameterLanguageD`, `recordLockTimeoutSeconds`, `deleted`, `modified`, `created`) VALUES
(1019, 'bug_dynamic-required', 'Minimal Example for Bug', '', 'test_table', 'sip', 'sip', 'c', 'bootstrap', '', '', 'exclusive', 'new,delete,close,save', 'none', '', '', '', 'client', '', '', '', '', '', '', '', '', '', 900, 'no', '2018-05-31 08:48:39', '2018-05-31 10:48:33');

INSERT INTO `FormElement` (`id`, `formId`, `feIdContainer`, `dynamicUpdate`, `enabled`, `name`, `label`, `mode`, `modeSql`, `class`, `type`, `subrecordOption`, `encode`, `checkType`, `checkPattern`, `onChange`, `ord`, `tabindex`, `size`, `maxLength`, `bsLabelColumns`, `bsInputColumns`, `bsNoteColumns`, `rowLabelInputNote`, `note`, `adminNote`, `tooltip`, `placeholder`, `value`, `sql1`, `parameter`, `parameterLanguageA`, `parameterLanguageB`, `parameterLanguageC`, `parameterLanguageD`, `clientJs`, `feGroup`, `deleted`, `modified`, `created`) VALUES
(732, 1019, 0, 'yes', 'yes', 'nodb_checkbox', 'Toggle', 'show', '', 'native', 'checkbox', '', 'specialchar', 'auto', '', '', 10, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '', 'checkBoxMode = single\r\nlabel2 = external speaker\r\nitemList = 1: \r\nchecked = 1\r\n', '', '', '', '', '', '', 'no', '2018-05-31 08:50:12', '2018-05-31 10:50:12'),
(733, 1019, 0, 'yes', 'yes', 'field1_int', 'Enter Int', 'show', '{{ SELECT IF(\'{{nodb_checkbox:FR0}}\'=\'1\', \'hidden\', \'required\') }}', 'native', 'text', '', 'specialchar', 'digit', '', '', 20, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '', '', '', '', '', '', '', '', 'no', '2018-05-31 08:51:45', '2018-05-31 10:50:33'),
(734, 1019, 0, 'yes', 'yes', 'field2_varchar', 'Enter Varchar', 'show', '{{ SELECT IF(\'{{nodb_checkbox:FR0}}\'=\'1\', \'required\', \'hidden\') }}', 'native', 'text', '', 'specialchar', 'auto', '', '', 30, 0, '', '', '', '', '', 'row,label,/label,input,/input,note,/note,/row', '', '', '', '', '', '', '', '', '', '', '', '', '', 'no', '2018-05-31 08:53:22', '2018-05-31 10:52:17');


Related issues

Is duplicate of QFQ - Bug #5077: 'Required' FormElement mit Dynamic UpdateClosedCarsten Rose09.12.2017

Actions
Actions #1

Updated by Carsten Rose almost 6 years ago

  • Is duplicate of Bug #5077: 'Required' FormElement mit Dynamic Update added
Actions #2

Updated by Carsten Rose almost 6 years ago

  • Status changed from New to Closed
Actions

Also available in: Atom PDF