• Resolved audaciouscreative

    (@audaciouscreative)


    Hi
    I don’t know if I’ve missed this in a previous post but what I’m trying to do is this:
    I’ve set up a Field Group and connected that to a form using the plugin.
    I then created a page on a test site with dynamic fields that connect to the various fields in my Group. If I enter information in the field in the backend of the page the information I enter is visible on the live page.

    What I want to know is if there is a way to connect a form entry to the fields on the page. So, for instance, I create a new Post or Page with the relevant template, select the Entry Number (#1268) and the fields are pulled from the Entry into the Fields. I can then update the page and the content is in.

    Does that make sense? Is this possible in any way?
    If not – that would certainly be a really useful feature to have!

    Cheers

    Stuart

Viewing 2 replies - 1 through 2 (of 2 total)
  • If I understand correctly, you want to pre-fill the form fields with values from the entry fields? If so, you can do it with $args: https://advancedforms.github.io/guides/basic/displaying-a-form/

    There’s the part ‘values’ => array() that you can use to pre-fill the form fields.

    For example, could use this in a template file:

    $args = array(
    	'values' => array('field_name_on_form' => $value_from_entry),
    );
    advanced_form('form_id_here', $args);

    This of course means that you have to first get the value from the entry and save it as a variable, in this case as $value_from_entry. How to do that depends on the field and how it is set up, but if you’re using ACF, there’s a pretty good documentation for things like this.

    If this is not what you’re after, then excuse me ??

    Plugin Author fabianlindfors

    (@fabianlindfors)

    Hi!

    If your aim is to be able to edit posts I would recommend checking out the pro version available here: https://hookturn.io/downloads/advanced-forms-pro/. It has post editing built-in which means you can just specify a post ID when displaying your form and it will automatically pull all fields from the post.

    If you want to do this yourself that is possible too! As @tuuuukka helpfully explained you can use the values argument to specify pre-filled values for your fields (fetched from your entry of choice). You could then use the af/form/submission hook to save the updated values back to your entry. This is how the pro version does it but a bit more automated!

    Also I should note, the built-in entries are mostly for administration and are not really meant to be used on the front-end. This means that they are set as non-public and if you want to use them as a regular post type you would have to change this with a filter. I would instead recommend creating a new post type and using that instead!

    Hope this helps! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Connect form entries to fields on page’ is closed to new replies.