carbon-fields icon indicating copy to clipboard operation
carbon-fields copied to clipboard

Update Post button doesn't work when there is a required field

Open deqngeorgiev opened this issue 7 years ago • 1 comments

Version

  • Carbon Fields: 3.0.2
  • WordPress: 5.1.1

Expected Behavior

Update Post button should become active when the user changes the value of some field or post title/content.

Actual Behavior

The Update Post button stays disabled and post couldn't be saved when ->set_required() has been used on some of the fields.

Container definition

Container::make( 'post_meta', __( 'Page Template: Homepage', 'crb' ) )
    ->where( 'post_type', '=', 'page' )
    ->where( 'post_template', '=' , 'templates/homepage.php' )
    ->add_fields( array(
        Field::make( 'text', 'crb_title', __( 'Title', 'crb' ) ),
        Field::make( 'text', 'crb_video', __( 'Video URL', 'crb' ) )
            ->set_required(),
        Field::make( 'rich_text', 'crb_content', __( 'Content', 'crb' ) ),
    ) );

Steps to Reproduce the Problem

  1. Add the above container
  2. Go to page/post template
  3. Try to edit field value and save the page/post

deqngeorgiev avatar Mar 22 '19 12:03 deqngeorgiev

Fixed in v3.1.0.

vvasilev- avatar Apr 01 '19 07:04 vvasilev-