• Resolved cknowles

    (@cknowles)


    Hi,

    I’m hooking into af/form/submission, and making a change to the value of one of the fields in the $fields array.

    I had assumed that would be enough, that my change would be automatically saved, but have found that not to be the case.

    I’ve since read that I need to use af_save_field to update a field, but it requires a post_id, and I don’t know what the post ID is – how do I retrieve the post ID? Or should I be making changes to the $fields array at some other point in order that my changes be saved?

    Many thanks in anticipation

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter cknowles

    (@cknowles)

    Just wanted to add to this that my form is configured with “Create entries” enabled, so I’m not creating a post – were I creating a post I know how I would go about retrieving the ID.

    Thread Starter cknowles

    (@cknowles)

    I’ve concluded that I should be doing this in the af/form/entry_created hook instead.

    Plugin Author fabianlindfors

    (@fabianlindfors)

    That sounds like the right way to go about it! Because of the way actions work in WordPress, changing the $fields argument won’t work as you noticed.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Update field value in af/form/submission’ is closed to new replies.