Support

Account

Home Forums Bug Reports Conditional Fields on Front End Forms

Solving

Conditional Fields on Front End Forms

  • Love the plugin. Saved me so many headaches for back-end form and now for front-end posting, which I had tried previously but didn’t have the know-how to accomplish.

    Anyhow, I wanted to report what I think is a bug with front-end forms but I’m not really sure. I’m using WP 3.9.1 and ACF 4.3.8.

    I have three select fields in one field group: a ‘city’ select with two options and two ‘neighborhood’ selects, one for each city that should display/hide depending on the selection. However, regardless of the city selection, you’d only see the first neighborhood select.

    I initially just used jQuery to show()/hide() the container divs for each neighborhood select as appropriate. This worked at overriding the ACF css (.acf-conditional-logic-hide), but the initially hidden select still had the disabled attribute set to disabled.

    So I had to do the crude fix of commenting out the show/hide logic in the ACF plugin files. input.js lines 722-749. I’m now controlling the select fields with my own jQuery. It’s not ideal, since I won’t be able to update the plugin, but it’s working. Just thought I should let you know.

    Thanks.
    John

  • I’ve came up against this before too and it’s still an issue as of v5.3.4

    There’s no console errors and i’m able to fix with separate js and no editing of the acf files.

  • I was having the same issue, but the solution was simple. Add acf_form_header() before any other wp_head related content. Example:

    function yourfunction_add_acf_header() {
      acf_form_head();
    }
    add_action( 'wp_head', 'yourfunction_add_acf_header', 0 );
  • Even with acf_form_head(); properly placed, no ACF JavaScript is loaded on the frontend. Only the styles are loaded.

  • I just tested in Twentyseventeen, and it works fine. For me, this is definitely an issue with my theme.

    For me, I had deregistered jQuery since my theme does need it. That was breaking ACF.

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

The topic ‘Conditional Fields on Front End Forms’ is closed to new replies.