• Resolved Alizon

    (@alizon)


    Hi,
    I created two forms with ACF-extended, one to create a CPT and one to edit the CPT in the frontend. The create forms works perfectly and all labels are displayed but in the edit form no labels are displayed only the input fields.

    The forms are both integrated with shortcodes in the same way in Oxygen Builder. I cannot find any settings regarding this and I cannot figure out why the labels are not displayed in edit-form in frontend.
    Please help!

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

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Thanks for the feedback!

    If one form display labels and not the other, then it means the other form has some specific settings or code that alter its behavior.

    First, I would recommend to check the “Label Placement” setting in your Form UI, under the “Settings” tab. Check that this setting is not set to “Hidden”.

    If that doesn’t fix the issue, you can try to inspect your form input HTML output with your browser, and check that you don’t have specific CSS rules that could hide field labels.

    If it still didn’t fix the issue, then you can try to re-create a new from from the beginning, and try to display it see if that fix the issue.

    Ultimately, if nothing worked, well maybe you have some custom code/hooks which prevent the label display. I would recommend to disable plugins one by one, including custom codes and scripts until you find the cause of the issue.

    Hope it helps!

    Have a nice day!

    Regards.

    Thread Starter Alizon

    (@alizon)

    Hi,
    thanks for your suggestions of actions. I have done as ypu suggested but nothing changes the output, the labels in the edit form are not displayed.

    When inspecting the html-code it looks like the label tag is empty and I see no css-rule that explains why it doens’t show up.
    Here is a screenshot of the html-inspection: https://www.awesomescreenshot.com/image/13965603?key=5a478311ff9a112273894db2678a2f9e

    There seem to be a class .acfe-no-label that is added to all enclosed divs in the form. The labels in the Settings area is set to “Top” so they are not set to hidden.
    https://www.awesomescreenshot.com/image/13964530?key=13bddae0e5252f9d87a6762418973914

    Can this be the cause?

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    The acfe-no-label class is added by ACFE when it is instructed to hide the field label with PHP (either a setting or custom code).

    • Have you checked your Form’s Field Group?
    • Do fields have settings which could cause label to be hidden?
    • Can you export your Field Group json?
    • Have you tested the last two solutions proposed earlier?
    • Like: create a new “Test Form” using a new “Test Field Group”?

    Regards.

    Thread Starter Alizon

    (@alizon)

    HI,
    yes I tested all your solutions earlier.

    The field groups do not have specific settings from what I can tell. If they had wouldn’t it affect both forms then? Now the labels are only displayed in the create-form and not in the edit-form.
    I have exported the fieldgroup json, do you want it and how can I send it to you?

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    So if you create a new “Test Form” that use a newly created “Test Field Group” with a simple “Text” field, that field label is also hidden in that form?

    Do you have any custom hooks in your installation? Like acf/prepare_field or acf/load_field?

    Yes please, you can share the json code using a site like pastebin.com

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    Any news?

    Regards.

    Thread Starter Alizon

    (@alizon)

    Hi,
    I think I have found the problem. When I added the shortcode to a new section in Oxygen the field labels was displayed. The former section had a condition applied to it to only show the form to the current inlogged author. Can you see from this code what is making the labels to not be displayed?

    if ( function_exists( 'oxygen_vsb_register_condition' ) ) {
    
        oxygen_vsb_register_condition(
            // Condition Name
            'Current CPT Author',
    
            // Values: The array of pre-set values the user can choose from.
            // Set the custom key's value to true to allow users to input custom values.
            array(
                'options' => array( 'true', 'false' ),
                'custom' => false,
            ),
    
            // Operators
            array( '==' ),
    
            // Callback Function: Name of function that will be used to handle the condition
            'wpdd_current_cpt_author_callback',
    
            // Condition Category: Default ones are Archive, Author, Other, Post, User
            'CPT'
        );
    
    }
    
    /**
     * Callback function to handle the condition.
     * @param  mixed 	$value    	Input value - in this case, true or false selected by the user.
     * @param  string 	$operator 	Comparison operator selected by the user.
     *
     * @return boolean 				true or false.
     */
    function wpdd_current_cpt_author_callback( $value, $operator ) {
    
        // if we are not on a singular page or
        // if we are on one of the standard built-in post types or
        // if user is not logged in
        // return false.
        if ( ! is_singular() || is_singular( array( 'page', 'attachment', 'post' ) ) || ! is_user_logged_in() ) {
            return false;
        }
    
        global $post;
    
        if ( 'true' === $value ) {
            return ( get_the_author_meta( 'ID', $post->post_author ) === wp_get_current_user()->ID );
        } else {
    	    return ( get_the_author_meta( 'ID', $post->post_author ) !== wp_get_current_user()->ID );
        }
    
    }
    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    If you remove these functions, do the field labels reappear?

    Unfortunately, I don’t know what those functions do, and I don’t see any related ACF functions in there either. The best way to be sure would be to contact the Oxygen support, and ask if that code could interfere with some ACF hook/logic.

    As a side note: If you need to add some specific condition on the Form Shortcode render you can use the acfe/form/load hook. You’ll find a usage example in the documentation.

    Hope it helps!

    Have a nice day!

    Regards.

    Thread Starter Alizon

    (@alizon)

    After more testing I noticed that it wasn’t that code which caused the problem. I have another condition set that the edit-form should only be displayed if the user has set the ad to edit mode. This is done with a ACF-field true/false. And if this is applied the labels are not dislayed. Edit mode is handled by another ACFE-form on the page that contains the field and an update button. May be you have another solution on how to turn on or off the edit mode by user?

    Plugin Author Konrad Chmielewski

    (@hwk-fr)

    Hello,

    I’m not sure to understand, your reports are too vague. Please provide some screenshots and code examples.

    • What exactly is “Edit mode”?
    • How the “ACF field true/false” interact with the other form? Do you use custom code? if so, have you tried to remove it?
    • What is the code that define “the form should only be displayed if the user has set the ad to edit mode”?

    As explained ealier, I would recommend to re-create a new “Test Form” with a new “Test Field Group” and new fields in it. Then try to display it on a new page.

    Ideally, I would recommend to remove any custom code to avoid any incompatibility. Once the initial “Test Form” works correctly, then you can add more complexity with custom code and logic, and try to reach the same level of complexity as the form that isn’t working, until you find the cause of the issue.

    Regards.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Field labels dissapear in edit form’ is closed to new replies.