Skip Navigation

[Resolved] Values truncated after switching post field from number to single line

This support ticket is created 5 years, 4 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 12 replies, has 2 voices.

Last updated by Nigel 5 years, 3 months ago.

Assisted by: Nigel.

Author
Posts
#1327031
Image 001.png

I'm trying to switch a field (property-price) from a number field to a single-line field. The client wanted more flexibility in what the price looks like. I've switched the field successfully to the single-line type, however, when I type something that is non-numerical, the content is truncated. For example, if I put $13,000,000, only the value "13" is stored.

What I've tried so far:
-Manually putting in $13,000,000 in the post meta field: Only "13" is shown in the post editor and the view
-Manually putting 13,000,000 (without the dollar sign): Only "13" is shown in the post editor and the view
-Manually putting 13000000 (No non-numerical ): Shows the correct value in the post editor and the view
-Remove the field completely and recreate a new field with the same name: No change in the behavior. Values are truncated after non-numerical value
-Switched it to a multi line: Same behavior as single-line, truncation after non-numerical value.

None of my other fields are acting the same way. I can put $13,000,000 in other single-line fields and the value appears to work as expected.

Please let me know if I can provide any more information on this issue. Thank you.

#1327149

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Collin

I've just tested the same on a local site and found that even after switching the field type from numeric to single line the validation (for a number) was still being applied.

I thought if I switched it back to numeric I could edit the field to remove the validation, but it seems like it is compulsory for a numeric field to have number validation, so I don't have a workaround right now.

I'm escalating this to my second tier so that they can check for a possible workaround before escalating to the developers.

#1327203

I'll hang tight until you hear back from them.

#1327801

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

This has been escalated to the devs to fix, but my colleague found that you can try editing this custom field (at Toolset > Custom Fields) and checking the validation (required), saving, then un-checking the validation and saving again, which should reset the field validation configuration.

Can you try that?

#1328093

I tried that with the affected fields and the value was truncated after the first non-numerical character. Please let me know if there's anything else I can try.

#1328121

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

I think I'll need a copy of your site, then, as the symptoms are slightly different than on my test site and what my colleague found, so there may be something else at play here.

Can you create a copy and share a link to the archives on dropbox or similar here, thanks.

hidden link

#1330797

Try this link: hidden link

#1331161

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Collin

That seems to be a copy of your WordPress directory, which I can't do anything with without the database.

Could you please create a site copy using Duplicator or All in One WP Migration (both free)?

#1331483

The database file is in the wp-content directory. It's the mysql.sql file. Sorry for the oversight on that.

#1332109

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Collin

I can confirm the issue on your site and I've done testing myself to try and get past the problem but cannot, so I'm escalating this so that my colleagues in second tier can do some deeper debugging.

I'll let you know what they find.

#1332263

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Collin

You have added some custom code to your child theme which produces the problem, and disabling the code fixes it.

The code is added with an undocumented filter:

add_filter( 'wpcf_fields_slug_' . $field_slug . '_value_get', 'number_comma_func');
#1332423

I had forgotten I had put that in there. That solved my issue. Thanks for catching that for me! Please consider this ticket resolved.

#1332479

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

OK, good to know, thanks for confirming.