Support

Account

Home Forums Front-end Issues Front-end form not outputting on multisite

Solved

Front-end form not outputting on multisite

  • I have ACF activated site-wide on a multi-site install.

    I have exported the ACF php code and pasted it into the theme’s functions.php.

    All works swimmingly.

    Except for a front-end form :S

    Here’s my simplified code (it’s wrapped in a form tag with several other fields):

    
    <?php
    // APPLICATION REQUEST
    if ( get_field('mws_options_application_submit_application_request', 'option') ) {
    echo "<div class='apply-section' id='section-application-request'>";
    echo "<h3>Why Would You Like to Join?</h3>";
        acf_form(array(
            'form'	=> false,
            'fields' => array('mws_application_request'),
        ));
    echo "</div>";
    }
    ?>
    

    It woks fine on my computer’s localhost with a SINGLE SITE install. But on my multi-site install here’s the HTML code that is outputting:

    <!-- acf-form-fields -->
    	</div><div class='apply-section' id='section-application-request'><h3>Why Would You Like to Join?</h3>	<div id="acf-form-data" class="acf-hidden">
    		<input type="hidden" name="_acfnonce" value="ab3dcb0c83" />
    		<input type="hidden" name="_acfchanged" value="0" />
    			</div>
    		<div class="acf-hidden">
    		<input name="_acf_form" value="eyJpZCI6ImFjZi1mb3JtIiwicG9zdF9pZCI6MjUsIm5ld19wb3N0IjpmYWxzZSwiZmllbGRfZ3JvdXBzIjpmYWxzZSwiZmllbGRzIjpbIm13c19hcHBsaWNhdGlvbl9yZXF1ZXN0Il0sInBvc3RfdGl0bGUiOmZhbHNlLCJwb3N0X2NvbnRlbnQiOmZhbHNlLCJmb3JtIjpmYWxzZSwiZm9ybV9hdHRyaWJ1dGVzIjp7ImlkIjoicG9zdCIsImNsYXNzIjoiIGFjZi1mb3JtIiwiYWN0aW9uIjoiIiwibWV0aG9kIjoicG9zdCJ9LCJyZXR1cm4iOiJodHRwOlwvXC9kZWZhdWx0Lm1lbWJlcnMud3NcL2FwcGx5XC8/dXBkYXRlZD10cnVlIiwiaHRtbF9iZWZvcmVfZmllbGRzIjoiIiwiaHRtbF9hZnRlcl9maWVsZHMiOiIiLCJzdWJtaXRfdmFsdWUiOiJVcGRhdGUiLCJ1cGRhdGVkX21lc3NhZ2UiOiJQb3N0IHVwZGF0ZWQiLCJsYWJlbF9wbGFjZW1lbnQiOiJ0b3AiLCJpbnN0cnVjdGlvbl9wbGFjZW1lbnQiOiJsYWJlbCIsImZpZWxkX2VsIjoiZGl2IiwidXBsb2FkZXIiOiJ3cCJ9" type="hidden" />	</div>
    	<div class="acf-fields acf-form-fields -top">
    	
    			
    	</div><!-- acf-form-fields -->

    Any ideas?

    Many thanks.

  • Honestly, I don’t know why it’s working on the local version.

    When specifiying fields to display, according to the documentation, you need to supply either the field key (looks something like field_123456789abcd) or field ID (which is the post ID for the field) http://www.advancedcustomfields.com/resources/acf_form/

    Try changing this line to use one of the above
    'fields' => array('mws_application_request'),

  • I’m applying some additional form customizing so my code isn’t as black and white as the documentation but the fact remains that it’s working locally but not on a multi site install. I’m baffled by this. Here’s my code:

    <form id="post" name="post" class="acf-form" action="" method="post">
    
    <?php
    // EMAIL ADDRESS
    echo "<div class='apply-section' id='section-email-address'>";
    echo "<h3>Email Address</h3>";
        acf_form(array(
            'form'	=> false,
            'fields' => array('mws_email_address'),
        ));
    echo "</div>";
    }
    // DATE OF BIRTH
    echo "<div class='apply-section' id='section-dob'>";
    echo "<h3>Date of Birth</h3>";
        acf_form(array(
            'form'	=> false,
            'fields' => array('mws_date_of_birth'),
        ));
    echo "</div>";
    ?>
    
    <!-- SUBMIT -->
    <div class="acf-form-submit">
    <input type="submit" name="submit" class="button button-primary button-large" value="Submit Application" />
    <span class="acf-spinner"></span>		
    </div>
    <!-- / SUBMIT -->
        
    </form>
  • Like I said above, I’m not sure how your getting it to work at all, local, remote, single site or multisite. The documentation for the acf_form() fields argument is:

    /* (array) An array of field IDs/keys to override the fields displayed in this form */

    field_IDs would be the database ID of the field. Field keys must start with field_. That means that to two places where you’re specifying the field to show should not work at all. The only thing that I can think of that would let it is possibly that the fields on your local site already contain data and the fields on the multisite do not, and if this is the reason then it’s is doing something that you can’t depend on it doing.

    Hope that makes sense.

  • Yep. You were right!

    Still have no idea why it was working locally on a single site install.

    Anyway, that sorted it. Thank you.

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

The topic ‘Front-end form not outputting on multisite’ is closed to new replies.