Roots Discourse

Sage 10 and ACF frontend form issues

Hi all,

I’ve recently started a new project using Sage 10 for the first time. I love it so far, however I’ve been running into some issues while using an ACF frontend form.

The main issue is that when I include an image upload field, submitting the form results in a blank page. I’ve found it impossible to debug because I get no PHP or JS errors.

This is the form, included in a custom page template:

@php
  acf_form(array(
    'id'		    	  => 'new-missing-person',
    'post_id'	    	=> 'new_post',
    'new_post'			=> array(
        'post_type'		=> 'missing-person',
        'post_status'	=> 'draft',
    ),
    'post_title'		=> true,
    'post_content'  => false,
    'uploader'      => 'basic',
    'field_groups'  => array('group_60d995c239730', 'group_60dac0c85af05'),
    'html_submit_button'  => '<input type="submit" class="py-2 px-3 rounded-lg bg-primary-500 text-white hover:bg-primary-700 cursor-pointer transition-colors" value="%s" />',
    //'return'			  => home_url('Vielen Dank!'),
    'updated_message' => 'Vielen Dank, Ihre Vermisstenanzeige wurde zur Prüfung eingereicht.',
    'submit_value'	=> 'Vermisstenanzeige aufgeben'
    )
  );
@endphp

To rule out any chance of error from that side of things, I’ve included acf_form_head() right before wp_head() in my index.php.

Interestingly, the same form works without any issue in Sage 9. I’m thinking that it might be related to the @php directive because that’s been causing me some issues as well, also resulting in blank pages.

I’d really appreciate any help.

EDIT:

I’ve now figured out by reading other Sage 10 threads that I had to set WP_ENV to development. I’ve now gotten the following error:

ErrorException thrown with message "Undefined index: filename"
Stacktrace:
#19 ErrorException in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:3490
#18 Illuminate\Foundation\Bootstrap\HandleExceptions:handleError in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/api/api-helpers.php:3490
#17 acf_validate_attachment in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-file.php:413
#16 acf_field_file:validate_value in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/fields/class-acf-field-image.php:407
#15 acf_field_image:validate_value in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-includes/class-wp-hook.php:292
#14 WP_Hook:apply_filters in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-includes/plugin.php:212
#13 apply_filters in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php:391
#12 acf_validate_value in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php:340
#11 acf_validate_values in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php:205
#10 acf_validation:acf_validate_save_post in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-includes/class-wp-hook.php:292
#9 WP_Hook:apply_filters in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-includes/class-wp-hook.php:316
#8 WP_Hook:do_action in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-includes/plugin.php:484
#7 do_action in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/validation.php:271
#6 acf_validate_save_post in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php:392
#5 acf_form_front:check_submit_form in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php:340
#4 acf_form_front:enqueue_form in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/plugins/advanced-custom-fields-pro/includes/forms/form-front.php:624
#3 acf_form_head in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-content/themes/vermisstensuche/index.php:6
#2 include in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-includes/template-loader.php:106
#1 require_once in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/wp-blog-header.php:19
#0 require in /Users/manuel/Dev/wordpress/vermisstensuche/app/public/index.php:17

EDIT 2:

Okay, I’ve done some digging and tried an older ACF Pro version, not expecting much. However, the frontend form works flawlessly using version 5.8.6 but throws an error using version 5.9.7.

Could this still be related to Sage 10? :thinking:

this error looks familiar, have a look here: Sage 10 & WooCommerce + Mollie

1 Like

Thanks a lot, I’ll look into and report back.