Carbon-fields: Complex Fields cause "Please fill out all required fields..." error

Created on 17 Jul 2017  Â·  9Comments  Â·  Source: htmlburger/carbon-fields

I'm not sure what's going wrong here, but using complex fields causes the "Please fill out all required fields highlighted below" regardless of filling in all possible fields.

functions.php

add_action( 'carbon_fields_register_fields', 'crb_attach_theme_options' );
function crb_attach_theme_options() {
    Container::make( 'post_meta', __( 'Icon Section', 'crb' ) )
        ->show_on_template(array("template-home.php"))
        ->add_fields( array(
            Field::make( 'complex', 'crb_icon_section', 'Icons' )->set_required( false )
                ->add_fields( array(
                    Field::make( 'image', 'icon_img', 'Icon' ),
                    Field::make( 'text', 'icon_title', 'Branch Title' ),
                    Field::make( 'text', 'icon_text', 'Branch Description' ),
            Field::make( 'text', 'icon_tease', 'Branch Tease' ),
                ) ),

I didn't stray far from the example here describing how to do it.

I've got other fields working fine, but this one just doesn't seem to want to be validated on the backend. I tried adding "->set_required( false )" to each of the fields with no luck. Any ideas?

[type] bug

Most helpful comment

2.0.3 was just released which includes a fix for this.

I'd really appreciate if people in this ticket update, confirm that the issue was resolved and post a quick reply here saying so (or otherwise) - thanks!

All 9 comments

I can confirm this. I am encountering the same within a plugin. I am using vertical tabs and find that the field is highlighted red as soon as I click Add Entry. I then receive the Please fill out… after attempting to save. However, I am only encountering this on my live server. I am not encountering it (with the same code) on my local dev server. Here is the code from my plugin file.

Container::make('theme_options', __( 'Seasonal CSS' , 'seasonal-css' ) )
    ->set_page_parent( 'themes.php' )
    ->add_fields( array(
        Field::make('complex', 'seasonal_css_rules', 'These styles will be applied during the set time range.' )
            ->add_fields(array(
                Field::make('text', 'seasonal_css_comment', 'Style Documentation')
                    ->set_width(100),
                Field::make('textarea', 'seasonal_css_rules', 'CSS')
                    ->set_width(100),
                Field::make( 'date_time', 'seasonal_css_start_datetime', 'Start Date' )
                    ->set_input_format( 'j F Y h:i A', 'j F Y h:i K' )
                    ->set_width(42),
                Field::make( 'date_time', 'seasonal_css_end_datetime', 'End Date' )
                    ->set_input_format( 'j F Y h:i A', 'j F Y h:i K' )
                    ->set_width(42),
                Field::make( 'select', 'seasonal_css_repeat', 'Repeat?' )
                    ->set_options( array(
                        'never'  => 'Never',
                        'yearly' => 'Yearly'
                    ))
                    ->set_width(16)
            ))
            ->set_layout('tabbed-vertical')
        ));

I believe the cause is a cache buster that we've missed to update causing you to load outdated assets.
Can you guys please clear your browser's cache and confirm that the issue is resolved?

I have this problem too, complex fields can not be saved. I cleared cache end even tried another browser, but the problem is still here.

I am not able to resolve the issue by clearing the cache. I've also attempted to access the page via a different browser (in which I've not accessed the page before). I've also uploaded my plugin to a new site on which it had not before been active. The issue persists in both situations.

I've just confirmed the issue is not caused by cache but a bug in the latest version. A fix should be live in the next hour or so.

2.0.3 was just released which includes a fix for this.

I'd really appreciate if people in this ticket update, confirm that the issue was resolved and post a quick reply here saying so (or otherwise) - thanks!

Tested it, it's working! Many thanks.

Confirmed, it's working now. Thanks a lot @atanas-angelov-dev :)

The fix is confirmed here. Working for me. Thank you!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ittikorns picture ittikorns  Â·  3Comments

jquimera picture jquimera  Â·  4Comments

Roman52 picture Roman52  Â·  3Comments

proweb picture proweb  Â·  3Comments

Mick00 picture Mick00  Â·  3Comments