Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to update page because of hidden required fields. #1215

Open
dtracey-fi opened this issue Jan 25, 2024 · 1 comment
Open

Unable to update page because of hidden required fields. #1215

dtracey-fi opened this issue Jan 25, 2024 · 1 comment

Comments

@dtracey-fi
Copy link

Version

  • Carbon Fields: 3.6.3
  • WordPress: 6.4.1
  • PHP: 8.0.30

Expected Behavior

Should be able to update the content as the fields do not pertain to the home page template.

Actual Behavior

You are unable to update the home page content, as the Update button is greyed and and cannot be clicked.

Container definition

 Container::make('post_meta', 'State Details')
            ->where('post_template', '=', 'page-landing.php')
            ->add_fields([
                Field::make('text', 'state_phone', __('State Phone Number', $this->text_domain))
                    ->set_width(50)
                    ->set_required(true)
                    ->set_attribute('placeholder', '2222 2222')
                    ->set_help_text('The phone number label for the hero meta box.'),
                Field::make('image', 'state_logo', __('State Logo', $this->text_domain))
                    ->set_width(100)
                    ->set_required(true)
                    ->set_help_text('The logo to show in the hero meta box.'),
            ]);

Steps to Reproduce the Problem

  1. Edit a page that doesn't use the template 'page-landing.php'
  2. Update button will be greyed out.

Steps to Temporarily resolve the Problem

  1. Select "Screen Options" on the top of the page editor.
  2. Tick the "State Details" option.
  3. Fill in the required "State Details" fields.
  4. The Update button will now be active.

Comments

When editing the home page template, or any other page that isn't using the 'page-landing.php' template, the Update button is greyed out, the fix is to show the "State details" fields in the "Screen Options" section and fill in the required fields.

@dtracey-fi
Copy link
Author

Any updates on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant