Notifications
Clear all

Blank values in select fields not retained

6 Posts
2 Users
0 Likes
176 Views
Posts: 32
Customer
Topic starter
(@lynne-benedict)
Member
Joined: 2 years ago

Hello!

We are using a forum with TCF with 7 select fields. Some of these fields are required, others not. When topics are created, we want the required fields to be pre-populated with default values, but the fields that aren't required should be blank. Also, when users try to do an advanced search by custom fields, NONE of the selects should be pre-populated.

We have found a way to accomplish this by adding a blank (or empty string) value to the beginning of each select field. Then for the value that should be the default on topic creation, we wrap it in square brackets ([ ]).

However, the problem is, when you go to edit a field, the first blank value disappears and has to be re-added before the field is saved. Even worse, ALL of the other select fields also have their blank first value deleted.

The only way to keep our topic creation and search working as we want is to manually edit the form in the database. In the `wp_wpforo_forms` database, in the appropriate `field` column, we have to edit all of the select fields so the "values" array starts with an empty string:

...values":["", "[creation_default]", "value2","value3"],"type":"select",...

Fix: When editing a field (especially a select field), retain any blank values that the user adds for that select field (and any other select fields)

5 Replies
Razmik
Posts: 76
Admin
(@blackraz)
Famed Member
Joined: 9 years ago

Hi @lynne-benedict 

Please confirm which version of the 'wpForo Topic Custom Fields' plugin you are using. The latest version is 3.2.1. We conducted tests on our end to create two dropdown fields, one of which is required and has a default value selected by wrapping it with brackets [], while the other dropdown field is not required but both are searchable.

When creating a new topic, the required field already has a selected default value, but the non-required field has a special dummy option "--- Choose ---". After successfully saving the topic, the required field retains its default chosen option value, while the non-required field is not saved because no option was chosen.

After conducting all experiments, I attempted to use the advanced search feature. On the advanced search page, all dropdown fields are not required and each has a first dummy option labeled "--- Choose ---".

It appears that the system is functioning correctly, and there are no issues related to default values or required/non-required fields. It's possible that you are using an older version of TCF. Please update to the latest version and try removing any additional custom coding on your end. After doing so, please test the mentioned functionality and let us know the results.

Reply
1 Reply
Customer
(@lynne-benedict)
Joined: 2 years ago

Member
Posts: 32

@blackraz 

We are still having the issue described in the original post with the latest version of 'wpForo Topic Custom Fields' plugin installed.

Reply
Posts: 32
Customer
Topic starter
(@lynne-benedict)
Member
Joined: 2 years ago

Hello,

I just confirmed we have the latest version of 'wpForo Topic Custom Fields' plugin installed.

For reference I've attached a screenshot of all the wpforo plugins we have installed currently.

image

L

Reply
Razmik
Posts: 76
Admin
(@blackraz)
Famed Member
Joined: 9 years ago

Hi @lynne-benedict 
Why haven't you updated wpForo to the latest version? The functionality for custom fields is provided by the "Topic Custom Fields" addon, but the form printing functionality is embedded within the wpForo core code. You should update all wpForo components, including the wpForo core and additional addons. Please update everything to the latest versions and test again.

Reply
Posts: 32
Customer
Topic starter
(@lynne-benedict)
Member
Joined: 2 years ago

OK I will get everything updated and try again. We are currently on a freeze and will be able to upgrade in about 3 weeks. Please keep this issue open until we confirm that upgrading resolves the issue.

Reply
Share:
Scroll to top