Hello.
My question is the same as the title.
I need to make a text field, with a max allowed character, the problem is that this field will be a ISBN book, so i need to allow numbers and the ‘-‘ char only.
I thinked about using a regex in my php template, but doing this every other character will be saved on my database.
Is there any better solution to this?
Thank you in advance.
Gianmaria Generoso.
Use an acf/validate_value filter https://www.advancedcustomfields.com/resources/acf-validate_value/.
Validation is done before saving.
I don’t understand the comment about data being saved in the DB.
Hi Gianmaria!
I would look into using the acf/update_value filter found here: https://www.advancedcustomfields.com/resources/acf-update_value/
You can even specify which fields you want to filter using the name={$field_name}
query.
Please let me know if you have any other questions or need anything else clarified.
Phil