Skip to content

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

@deqngeorgiev

Description

@deqngeorgiev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions