• Hi,

    I’m using CF in my plugin for admin and custom post options and it’s working beautifully so far.

    However, how can I validate a field server-side? For instance, say I have a text field which I want to insure contains an e-mail address. Where would I create my validation code? Is there a callback?

    I can’t find anything in the docs.

    I realize there is front-end validation with React, but this doesn’t seem to be very secure, since a user could modify it and then add junk data.

    Thanks,
    DC

Viewing 2 replies - 1 through 2 (of 2 total)
  • Are you using the 1.6 version of the plugin here, or a newer version (it is recommended that you use the latest). There are 2 on save filters for fields:
    https://carbonfields.net/docs/advanced-topics-hooks/

    I can’t link to the specific section because that page doesn’t have section IDs, but scroll down to the “Field” section. There are some container actions, too – you may wish to do a Find in your browser for “_save” (minus quotes) to see the others.

    Thread Starter dietcheese

    (@dietcheese)

    Thanks.

    Are there any examples online on how to use this? For example, I see of no way to pass back error messages to the front end in the case where input is invalid.

    Even a simple example, for instance on validating an e-mail address, would be very helpful.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Field Validation’ is closed to new replies.