carbon-fields
carbon-fields copied to clipboard
Update Post button doesn't work when there is a required field
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
- Add the above container
- Go to page/post template
- Try to edit field value and save the page/post
Fixed in v3.1.0.