Skip Navigation

[Resolved] Checkbox Custom Fields Defaulting to "unchecked" after Types Upgrade

This support ticket is created 6 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 20 replies, has 3 voices.

Last updated by Luo Yang 6 years, 4 months ago.

Assisted by: Luo Yang.

Author
Posts
#907568
checkbox.jpg

I just recently upgraded to the newest versions of TOOLSET plugins.

For some reason, now when I go to edit a Custom Post, after I click the UPDATE button, any custom fields that of a CHECKBOX variety get set to "UNCHECKED" after the UPDATE is complete.

It doesn't matter what I do. If I place a checkmark in each box (mark them CHECKED) then after I UPDATE the post they immediately appear as UNCHECKED.

#907701

There are 2 possibilities:
- either that checkbox(es) value is not trivial (it has special characters like <,>,/,\,etc) in the value.
https://toolset.com/forums/topic/custom-field-stopped-working-after-upgrade-of-toolset/
- Or, you have a Parent (related) Posts table in that Post edit screen.
(Means, you have this post type in a post type relationship with another type
For this case I still need to find out what exactly is provoking the issue, as all I know by now is, if you have a Parent Post table in the Edit Screen and a checkbox in the actual edited post, that does not save.

But, it must be related to what fields are present in the related post table, and that, I was not yet able to find out.
My colleague Mohammed had initially contact with a user who has seen that issue:
https://toolset.com/forums/topic/check-boxes-are-not-being-saved-as-being-checked/

On that ticket, these are the thing I found which are not native to a default install and ay cause the issue:
- These fields save 0 to the database.
- The same fields do work on any other post type, this happens only (and as well with new fields) on the post type "Dispatch Request"
- If you use the same fields on any other post type, they work
- Hence, it's this post types setting that break the checkbox.
- There are post relationships with even more checkboxes in there connected to the "Dispatch Request" post type.
==> If you delete these connections the issue is resolved.

I could not yet replicate locally yet, and I as well saw user client did not run the migration yet. which might be related.

As you see, I am aware of the issue only from the user's perspective and was not yet able to determine what exactly provokes this issue.
Maybe I have more luck with your example!

Could you eventually check if:
- removing the post type relationship solves the problem?
- if so, what exact fields in the parent/related post types do you have?

I suspect it is related to having another kind of select fields in a parent post which is not saved, and that overwrites the current post.
But I tried to replicate this and failed too.

So I am still missing a crucial point in replication.
Eventually you can help me to see what I miss, otherwise, the developers are as well on this and we will get to the bottom of it ASAP

PS - I would have logged in to check this all myself but the password is not valid for the user you provided.

#908434

The WordPress Admin information that I provided works. I have verified it.

The FTP information has changed. (I provided old info). New IP is 174.128.43.79

Please send me another private info field and I will resend that info. You can check things yourself.

All of my CPT's are a bit complex and this is a VERY big site.

I haven;t completed the TOOLSET Migration yet because I have a lot of Legacy relationships that need fixing. I am doing that now as fast as I can..

#908645

Hello,

In order to debug this problem, please provide a database dump file (ZIP file) of your website in below private detail box, also point out the problem page URL, I need to test and debug it in my localhost, thanks

#909164
#909208

Thanks for the details, I am downloading the files, will feedback if there is anything found

#909211

Thanks for the details, it is a know problem, there is an issue with the Checkbox fields that save “0” when they are not set on a post.

Our developers have provide a errata for this:
https://toolset.com/errata/checkboxes-that-save-0-are-interpreted-as-checked-by-views/

Please let me know if you need assistance to adjust the codes

#910795
Custom-Field-Group-Change.jpg
checkbox.jpg

I sitll cannot get this to work.

I went into the TOOLSET >> Custom Fields and editted the custom field(s) for all checkboxes so that they would not save a "0" to the database.

Then I went back out the Custom Post and tried to edit it again... and nothing changed. I still cannot get the checkbox to remain checked.

I cannot even see that specific custom field when I scroll down and look in the Custom Fields metabox while I edit the item. It is almost as if the Custom Field doesn't exist for that post.

Please help.

#910819

I even used ALL EXPORT PRO and exported all of the appropriate CPTs and their checkbox custom fields... and I cahnged all of the "0" (zeroes) to "" (blanks) and then imported it back to the DB... still without any luck.

#911002

Thanks for the feedback, I can see the problem with your database dump file, and it is marked as bug in our to-do list, our developers are working on it, I will update this ticket if there is anything news

#911962

I really need to get this resolved. If you think it would be helpful, I can cahnge the checkbox to a Radio Button and see if it helps some of the more important issues.

If you don't want me to do that, then I will need a solution or work-a-round very soon. Large portions of my website are not working becasue I cannot keep a checkbox checked inthe adminm section.

#912189

Our developers are working on it, I am not sure when will it be fixed.

We have noticed that the issue goes away if you run the post relationship migration process by going to Toolset > Relationships. Otherwise, the problem occurs. If your site is ready to migrate to new post relationships, this problem may be resolved automatically. Please create a full backup of your site files and database before migration.

#912195

Update the post status.

#912355

A couple of things.

What do you mean... "Update the Post Status"?

Also, I have already tried the migration script. My site is a bit complex and we have some custom functions that synchronize some CPTs. The migration broke that synchronization and alos changed some taxonomies.... ultimately breaking my site.
It is going to be very hard for me to go through the entire site and fix everything... especially not knowing exactly how the new DB structure will be after migration. I want to do the migration.. but I cannot afford to have the site be destroyed.

#912757

Since the credentials you provided above is not valid any more:
https://toolset.com/forums/topic/checkbox-custom-fields-defaulting-to-unchecked-after-types-upgrade/#post-907568
I get this error:
ERROR: The password you entered for the email address support@wp-ty***.com is incorrect

I have tried below steps in my localhost with your database dump file, using below steps:
1) Upgrade to the latest version of Types plugin 3.0.1 + Other latest version of Toolset plugins
You can download them here:
https://toolset.com/account/downloads/
2) Dashboard-> Toolset-> Custom fields
edit field group "Administration", make sure the custom checkbox field "Featured Business" and "Remove No-Follow Link?" are using option "don't save anything to the database"
3) Edit a "Hotel" post, enable the checkbox fields: "Featured Business" and "Remove No-Follow Link?" , save the post, then I can see they are saved correctly.

Can you try to upgrade the Types plugin and feedback if it is fixed or not?
If the problem still persists, please provide the credentials of your website in below private detail box, I need to debug it in a live website, thanks