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

ACF: character limit validation error for standard fields #1292

Closed
reekrd opened this issue Mar 16, 2023 · 5 comments
Closed

ACF: character limit validation error for standard fields #1292

reekrd opened this issue Mar 16, 2023 · 5 comments
Labels
enhancement New feature or request module: ACF Integration with ACF

Comments

@reekrd
Copy link

reekrd commented Mar 16, 2023

Validation of character limit for basic text fields fails because the string contains language information.

Create a new Basic Text field using ACF. Under validation set Character Limit to 10.

Now if you try to save this field with the value 'qwerty' you will see 'Value must not exceed 10 characters'

The function validate_value in class-acf-field-text.php sees the value [:en]qwerty[:] which is longer than 10 characters.

I did not now that language information was saved in basic text fields. Is this a somewhat new approach?

On our production server we have five languages enabled.

If I update a page or post where we use Basic Text fields they now contain all languages.

Basic text field value before updating the post: the text
Basic text field value after updating the post: [:en]the text[:nl]the text[:de]the text[:es]the text[:fr]the text[:]

Validation needs to be done per language but validate_value does it on the entire string

PS we have been running qTranslate for years in this project before we migrated to qTranslate-XT

@herrvigg herrvigg added enhancement New feature or request module: ACF Integration with ACF labels Mar 21, 2023
@herrvigg
Copy link
Collaborator

Related to #710. I may close one of the two tickets.

@reekrd
Copy link
Author

reekrd commented Mar 27, 2023

Sure, close this one. Perhaps add to #710 that it also regards basic fields and not only ACF qTranslate Fields.

@herrvigg
Copy link
Collaborator

herrvigg commented Apr 1, 2023

Indeed it might be different concerns between ACF standard fields and qTranslate extended fields.

@herrvigg herrvigg changed the title ACF Pro 6.0.6 & 6.0.7 - Character limit validation error for basic text fields ACF: character limit validation error for standard fields Apr 1, 2023
@herrvigg
Copy link
Collaborator

herrvigg commented Apr 1, 2023

I think I found a solution, merged in master. The validation will check the multilingual values for all standard fields that are enabled, potentially text/textarea/wysiwyg. Let me know how this works.

@herrvigg
Copy link
Collaborator

herrvigg commented Apr 2, 2023

Released in 3.14.0.

@herrvigg herrvigg closed this as completed Apr 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request module: ACF Integration with ACF
Projects
None yet
Development

No branches or pull requests

2 participants