• Resolved johnzenausa

    (@johnzenausa)


    I’m creating a business directory and would like to include a contact owner form with just the email address of the business owner and a text area. My question is as follows. On the back end there’s an ACF field for me to enter the email address. Is it possible to auto populate that field in the form. That is whatever I add to the box in the admin area automatically gets added to the contact form?

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author fabianlindfors

    (@fabianlindfors)

    Hi!

    There sure is a way to achieve this. When displaying your form you can pass a values argument with values to pre-fill your fields with. The way I would do this is write some code that fetches the business owner email from the ACF field and then passes it along to the advanced_form function. Something similar to this:

    
    $business_email = // add code here to get business owner email;
    advanced_form( 'FORM_KEY', array(
      'values' => array(
        'EMAIL_FIELD_NAME' => $business_email,
      ),
    ));
    

    Hope this helps!

    Thread Starter johnzenausa

    (@johnzenausa)

    Yes that helps. Thanks a lot.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Auto Populate Email Field’ is closed to new replies.