Support

Account

Home Forums General Issues Update/Add values to Relationship field using Gravity Forms

Solved

Update/Add values to Relationship field using Gravity Forms

  • I’ve got 2 front end gravity forms that create new posts – ‘Locations’ and ‘Staff’. The idea is to direct the user to create a new location with the first form and then on submit, redirect to the second form where they create Staff. I have a relationship field on the Staff post type so that we can display the staff on the location pages and vise versa. My issue is that I can’t get the custom fields in the gravity form to post to the relationship field. I am using a select field that is dynamically populated by the Location CPT titles. Is this even possible?

  • An ACF relationship field contains an array of post IDs.

    I do not know how to do this so this is a guess.

    First, you would have to alter the redirect url to include the location post ID that is created in the query string for the staff post type create form and dynamically populate the location field.

    Then you need to custom code an action on whatever hook gravity forms provides for when a form is submitted. In this filter you would have to update both ends of this relationship field yourself using update_field().

  • Thanks for the info. I found another solution.

  • Would be nice to know what the solution was / is.. it would help others looking to do the same.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.