$form_config_security_check

Hello
We have tried to change de name of a field using the new Data feature. That didn't work: the only response was Error.
Then we tried to restore the old situation using phpMyAdmin, since we could not access the application any more.
The result then was an error Table/view OM_documenten, form configurator, unexpected primary key field for lookup table: bestemming. Check $form_config_security_check in config.php for additional details, directing us to $form_config_security_check in config.php.
After setting the parameter to 0 we could access the application, but we don't have a clue as to what is wrong.

In the forms configurator for OM_documenten, primary key field, we don't see anything bizarre.

Any hints?

Thanks, Ronny



Your current DaDaBIK version​

You are using DaDaBIK version 11.3-Elba enterprise, installed on 08/02/2022 (installation code: 133315a7493334bfea), the latest version of DaDaBIK is 11.3-Elba released on 17/01/2022
You are runnning the latest release of DaDaBIK
In case you want to upgrade to a more powerful edition (from Pro to Enterprise/Platinum, from Enteprise to Platinum) please contact us.

System info​

PHP Version: 7.4.27
mysql version: 10.3.24-MariaDB-cll-lve
Web server: Apache/2
Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:97.0) Gecko/20100101 Firefox/97.0
URL installation:
 

eugenio

Administrator
Staff member
Hello Ronny,
the unexpected primary key field for lookup table error is triggered if, in form configurator, you have as Lookup table primary key field a field that does not exist in you database. Double check if the name you have there is the same you have in your db schema.

About the error in the data section, we should investigate why it happened, next time you try, if you are familiar with the browser console, you should check for errors there and, in the network section (I am referring to chrome but you have similar info in other browser), check the response to the call to api.php?function=alter_table

Then we tried to restore the old situation using phpMyAdmin, since we could not access the application any more.

I am not sure what you mean here, after that "error" message what happened if you tried to access the application?

Best,
 
Hello
I understand the meaning of the error unexpected primary key field for lookup table. The explanation in config.php was clear enough. So I already checked the names both in the lookup table and in the forms configurator.

The original error: when I changed the field name in the Data configurator I got the message in green OK.
But then when I exited the admin section, I just got Error on the screen.
I think this was my mistake since I changed the name of a field in a lookup table without changing the forms that use the lookup table.
Using phpMyAdmin I could set this straight again. But when I tried to change the field in the lookup table and the forms then I got the unexpected primary key field for lookup table error and now I can't fix it any more.

Best regards, Ronny
 

eugenio

Administrator
Staff member
Yes, once you change a field name from the data section, form config and permissions are automatically updated but the parameters of the lookup fields need to be fixed, that is probably the original reason of the error.
I am not sure in which situation you are now, if everything is "in synch" the unexpected primary key field for lookup table shouldn't appear.
Have you checked all the tables to see if maybe the same field was used for many lookup fields?
Also try to logout and login again.

Best,
 
Hello,

I discovered following concerning this matter.
When I inspected the Permissions on the fields of the lookup-table, I discovered that the field name had been changed (this was the purpose of the action of Ronny - see start of this item). That changed name apparantly "existed" only in the Permissions tab (and neither in the actual SQL-tables). I got rid of this anomaly by executing "Add fields" in DB Synchro. I got the message "0 fields added", BUT the name in Permissions was corrected to the original name. And the problem (error Table/view OM_documenten, form configurator, unexpected primary key field for lookup table: bestemming. Check $form_config_security_check in config.php for additional details) was gone.

THEN I performed an other name change on another field (that had no lookup-table). I changed the name using DB Synchro, but that didn't have any effect. Is this normal? Then I changed the name of that field in the Data tab and this action did the job.

Can you comment?

Kind greetings,

Hendrik
 

eugenio

Administrator
Staff member
Hello,
sorry I am lost.
Could you explain with an example what happened?

Generally speaking:

- if you change a field name from outside dadabik, you have to use the db synchro (only step 1, the others are useless in this case)
- if you change a field name from the DATA page, the db synchro is executed automatically

What does the db synchro - step 1 do?
- rename the field in the form configurator (field name)
- rename the field in permissions
- rename the unique field in the pages tab (only if you are changing the name of a unique field)

The db synchro at the moment doesn't rename the field in other settings, for example Lookup table primary key field.

This should explain what happened, let me know if it doesn't.

Best,
 
Eugenio,

I am no longer talking about the Lookup table primary key field. It is still unclear to us how/why it happened exactly, but that's fixed.

Now I am talking about a name change of a field that is not referring to any lookup table at all.
I will give you an example using db synchro step 1.
I changed the name of the field "locatie" to "lokatie".
What you say about the consequent changes in form configurator and permissions is correct indeed.
BUT:
- in the Data tab the corresponding field has still the original name "locatie"
- in the corresponding mySQL-table the corresponding field has still the original name "locatie"
- and when I perform "Exit admin" I get following error message
Error message after changing a field name in DB Synchro.jpg

Simply field "lokatie" is not found. And that is normal because it actually doesn't exist really (it only exists in some DDB-tables).
Note: I get the same error message when I try to show the contents of OM_documents in DDB.

So: the point I'm trying to make, is that there is some internal DDB-inconsistency happening when you change a field's name using db synchro step 1.

Note: when I change the name of that field back from "lokatie" to "locatie" I receive no error message anymore and everything is back to normal.
 

eugenio

Administrator
Staff member
Hello,
I think you misunderstood the purpose of the DB Synchro page.
DB Synchro - step 1 allows to synch dadabik with a field renaming you made outside DaDaBIK (e.g. via phpmyadmin).
If you use it without having actually changed the name, you are telling DaDaBIK that a field name has changed, but it hasn't changed.

Best,
 
Eugenio,

that was what I already thought. But since you get no error message right away, you do not realize having done something that can get you into trouble!

Kind greetings,

Hendrik
 
Top