Hi.
I decided to start all over again, from start. A clean start, as they say.
I deleted all form test I had and start a new one.
===TABLE===========================================
CREATE TABLE `cat5_org` (
`org_id` int(11) NOT NULL,
`org_sigla` varchar(50) NOT NULL,
`org_nome` varchar(255) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
ALTER TABLE `cat5_org` ADD PRIMARY KEY (`org_id`);
ALTER TABLE `cat5_org` MODIFY `org_id` int(11) NOT NULL AUTO_INCREMENT;
===Form, from beginning=================
New form => empty form
Settings
Title: orgaos
Alias: orgaos
Debug: on
Multi page Form: off (otherwise it keeps showing the same data over and over)
pages/Views
new text field/General
Label: Sigla
Name: org_sigla
Value: {var:read_data3.Data3.org_sigla}
new text field/General
Label: Nome
Name: org_nome
Value: {var:read_data3.Data3.org_nome}
new Button/General
type: submit
new Hidden field/General
name: org_id
Value: {var:read_data3.Data3.org_id}
pages/Actions/load
new Read Data (read_data3; model name: Data3)
Database table: cat5_org
Select type: First maching record
Where conditions
org_id = {data:id}
pages/Actions/submit
new Save Data
Database table: cat5_org
Data provider: {Data3}
Case 1 - Update =======================================================================
http://www.conhecimentopublico.com.br/index.php?option=com_chronoforms6&chronoform=orgaos&id=112
====Debug Load========================================================================
Array
(
[option] => com_chronoforms6
[chronoform] => orgaos
[id] => 112
[rot] => http://www.conhecimentopublico.com.br/C5/tabelas/orgaos?ope=rev
[pes] => 648
[Itemid] =>
[event] => submit
[org_sigla] => MAPAaaab22
[org_nome] => Ministério da Agricultura, Pecuária e Abastecimento
[button3] =>
[org_id] => 112
)
Array
(
[read_data3] => Array
(
[log] => Array
(
[0] => SELECT `Data3`.`org_id` AS `Data3.org_id`, `Data3`.`org_sigla` AS `Data3.org_sigla`, `Data3`.`org_sigla_longa` AS `Data3.org_sigla_longa`, `Data3`.`org_nome` AS `Data3.org_nome`, `Data3`.`org_nome_ident` AS `Data3.org_nome_ident`, `Data3`.`org_pai_id` AS `Data3.org_pai_id`, `Data3`.`org_sup_id` AS `Data3.org_sup_id`, `Data3`.`org_nivel` AS `Data3.org_nivel`, `Data3`.`org_seq` AS `Data3.org_seq`, `Data3`.`org_seq_fim` AS `Data3.org_seq_fim` FROM `cat5_org` AS `Data3` WHERE `Data3`.`org_id` = '112' LIMIT 100;
)
[var] => Array
(
[Data3] => Array
(
[org_id] => 112
[org_sigla] => MAPAaaab
[org_sigla_longa] => MAPAzaz
[org_nome] => Ministério da Agricultura, Pecuária e Abastecimento
[org_nome_ident] => Ministério da Agricultura, Pecuária e Abastecimento
[org_pai_id] => 0
[org_sup_id] => 112
[org_nivel] => 1
[org_seq] => 8000
[org_seq_fim] => 15999
)
)
)
)
===================================================================================================
=== RESULT===================================
error
1062 Duplicate entry '112' for key 'PRIMARY'
Case 2 - Update =======================================================================
http://www.conhecimentopublico.com.br/index.php?option=com_chronoforms6&chronoform=orgaos&id=112
===Debug load=====================================================================
Array
(
[option] => com_chronoforms6
[chronoform] => orgaos
[id] => 0
[rot] => http://www.conhecimentopublico.com.br/C5/tabelas/orgaos?ope=rev
[pes] => 648
[Itemid] =>
)
Array
(
[read_data3] => Array
(
[log] => Array
(
[0] => SELECT `Data3`.`org_id` AS `Data3.org_id`, `Data3`.`org_sigla` AS `Data3.org_sigla`, `Data3`.`org_sigla_longa` AS `Data3.org_sigla_longa`, `Data3`.`org_nome` AS `Data3.org_nome`, `Data3`.`org_nome_ident` AS `Data3.org_nome_ident`, `Data3`.`org_pai_id` AS `Data3.org_pai_id`, `Data3`.`org_sup_id` AS `Data3.org_sup_id`, `Data3`.`org_nivel` AS `Data3.org_nivel`, `Data3`.`org_seq` AS `Data3.org_seq`, `Data3`.`org_seq_fim` AS `Data3.org_seq_fim` FROM `cat5_org` AS `Data3` WHERE `Data3`.`org_id` = '0' LIMIT 100;
)
[var] =>
)
)
===Debug submit=====================================================================
Array
(
[option] => com_chronoforms6
[chronoform] => orgaos
[id] => 0
[rot] => http://www.conhecimentopublico.com.br/C5/tabelas/orgaos?ope=rev
[pes] => 648
[event] => submit
[org_sigla] => aaa teste
[org_nome] => aaa teste
[button3] =>
[org_id] =>
[Itemid] =>
)
Array
(
[submit_validate_fields] => Array
(
[log] => Automatic validation enabled.
[var] => 1
)
[save_data4] => Array
(
[data] => Array
(
[created] => 2020-03-13 16:37:18
[user_id] => 648
[org_sigla] => aaa teste
[org_nome] => aaa teste
[org_id] =>
)
[_success] => Data saved successfully
[log] => Array
(
[0] => INSERT INTO `cat5_org` (`org_sigla`, `org_nome`, `org_id`) values ('aaa teste', 'aaa teste', '');
)
[var] => Array
(
[org_sigla] => aaa teste
[org_nome] => aaa teste
[org_id] => 241
)
)
)