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

[5.2] Error on saving nested Subform #44168

Closed
coolcat-creations opened this issue Sep 30, 2024 · 18 comments
Closed

[5.2] Error on saving nested Subform #44168

coolcat-creations opened this issue Sep 30, 2024 · 18 comments

Comments

@coolcat-creations
Copy link
Contributor

Steps to reproduce the issue

When I try to save this nested subform, the entries are saved but still I get the error:

Save failed with the following error: Field 'value' doesn't have a default value
grafik

grafik

If I disable the nested subform no error appears.

Expected result

no error

System information (as much as possible)

The currently installed Joomla! version is "‎5.2.0-rc1-dev" ‎5.2.0-rc1-dev

@brianteeman
Copy link
Contributor

From the information provided I could not replicate the error

@coolcat-creations
Copy link
Contributor Author

Maybe because I updated the site with an update package ? No clean installation...
Not sure how to debug.

@coolcat-creations
Copy link
Contributor Author

I tested it on another site I upgraded from 5.1.4 to 5.2 nightly build and same:
The error appears when data is added into the nested subform (in my case the grid items)

grafik

@brianteeman
Copy link
Contributor

are you sure the problem isnt from the first field where you have not selected an item?

@coolcat-creations
Copy link
Contributor Author

Yes because if I leave the "grid" fields empty the error does not appear and because in my first testing site no other fields exist.

@hayyi
Copy link

hayyi commented Sep 30, 2024

I encountered the same error, but resolved it by changing my database column from non-nullable to nullable, which made the error disappear. I'm not sure if this is related to your issue, but it might be worth checking your database for the stored value

@coolcat-creations
Copy link
Contributor Author

Ok but thats a fresh install of 5.1.4 + Update to RC1, not sure sending the users to the database is a good user experience. Maybe this set to Nullable could be implemented in the update?

@brianteeman
Copy link
Contributor

It should be NULL by default

@coolcat-creations
Copy link
Contributor Author

I confirm it was NULL

@brianteeman
Copy link
Contributor

So it is nothing to do with that then

@coolcat-creations
Copy link
Contributor Author

Agree, but the error is there anyway.

@coolcat-creations
Copy link
Contributor Author

Updated to RC1 and issue still exist

@brianteeman
Copy link
Contributor

From the information provided I could not replicate the error

Maybe if you provided more details on the exact setup of the fields someone will be able to help you. As it is right now, based on the limited information in your screenshots I still cannot replicate this.

@coolcat-creations
Copy link
Contributor Author

It seems it was an issue with the nightly build package,
I installed again a new 5.1.4 made an update to 5.2 RC1 and the issue did not appear anymore.
now I installed again a new 5.1.4 made an update by uploading the folder into the joomla update component to make sure I did the same like in the failed ones and the issue did not appear. Closing.

@coolcat-creations
Copy link
Contributor Author

I have to reopen this again because I have the same Error on a fresh install of Joomla 5.2

@richard67
Copy link
Member

richard67 commented Nov 5, 2024

The error message refers to a value not being given for a database column with name "value" in an "INSERT" SQL statement and that database column does not have a DEFAULT value in the database structure so the value HAS to be specified when inserting data.

It's very likely the "value" column of the "#__fields_values" table, and for that column we do not specify a default value by purpose here: https://github.com/joomla/joomla-cms/blob/5.2-dev/installation/sql/mysql/supports.sql#L226

The reason why we do not specify a default value is because that is not allowed on MySQL 8, see here: https://dev.mysql.com/doc/refman/8.4/en/blob.html

BLOB and TEXT columns cannot have DEFAULT values.

The "TEXT" refers to data types "TINYTEXT", "TEXT", "MEDIUMTEXT", and "LONGTEXT", so for CHAR or VARCHAR columns we still can use DEFAULT values.

See also PR #27937 which removed the DEFAULT values from such column so Joomla works on MySQL 8-

Even if you could change the database to have a DEFAULT value for such a column when you are on MariaDB, we cannot do that because we do not have different data structures for MySQL and MariaDB.

So the database is as it should be, and the error must be in some PHP code which does the "INSERT" into that table without specifying a value for that column (even NULL would be ok as value).

@Fedik As you know much about our subforms: Do you have an idea where that could go wrong? Maybe something with a TABLE class removing all columns from the insert statement when it has a NULL value? Could that be related to what you handle with your PR #43905 ?

@Fedik
Copy link
Member

Fedik commented Nov 5, 2024

It is more likely after we allowed the nested form for Subform Custom field #43204

The Subform itself has an issue with handling nested form which have a default value or min attribute, #43652

Make sure your nested subform does not have these attributes.

@coolcat-creations
Copy link
Contributor Author

Closing again since its an issue with jfilters.

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

6 participants