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

Empty required fields only display error if we interact with them #627

Closed
psaikali opened this issue Dec 31, 2018 · 0 comments
Closed

Empty required fields only display error if we interact with them #627

psaikali opened this issue Dec 31, 2018 · 0 comments

Comments

@psaikali
Copy link

psaikali commented Dec 31, 2018

Version

  • Carbon Fields: 3.0.0
  • WordPress: 5.0.2
  • PHP: 7.2

Expected Behavior

A Theme Options page should throw a JS error when trying to save an empty required field.

Actual Behavior

If we don't interact (focus/blur) on a required field and leave it empty, we can save the form without any error being displayed. Checking on the required fields should not only be triggered when the field is focused/blurred, but when the form is submitted.

Demo

cf

Container definition

$theme_options = Container::make( 'theme_options', __( 'Lastweets', 'lastweets' ) );
+
$fields[] = Field::make( 'text', 'lastweet_consumer_key', __( 'Consumer API Key', 'lastweets' ) )->set_required();

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

No branches or pull requests

2 participants