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

Custom Fields marked Required do not work with the Gutenberg Editor #5367

Open
devont3 opened this issue May 2, 2019 · 3 comments

Comments

Projects
None yet
3 participants
@devont3
Copy link

commented May 2, 2019

Describe the bug
I've extended the Post Type and added two custom fields:
(1) simple custom defined list w/ multi select, and
(2) simple custom defined list w/ single select AND default value.

These fields display correctly in the post editor (with red asterisks, and the second custom field defaulted to correct value). However, when I do a test post where I select no value for the first custom field, and leave the second custom field at default, WP allows me to publish - no errors or banners telling otherwise.

To Reproduce
Steps to reproduce the behavior:
See screenshots below.

Expected behavior
If the required custom field has no selection, the user cannot publish without filling in the required fields.

Screenshots
Extend Post Type and add custom fields.
Screen Shot 2019-05-02 at 5 48 54 PM

Create a new post to test.
Screen Shot 2019-05-02 at 5 41 34 PM
Screen Shot 2019-05-02 at 5 42 12 PM
Screen Shot 2019-05-02 at 5 42 26 PM
Screen Shot 2019-05-02 at 5 42 39 PM

Pods Version

Version 2.7.12

WordPress Environment

Debug Information
WordPress Version: 5.1.1

PHP Version: 7.0.33-0ubuntu0.16.04.4

MySQL Version: 5.5.5

Server Software: nginx/1.10.3

Your User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36

Session Save Path: /var/lib/php/sessions

Session Save Path Exists: Yes

Session Save Path Writeable: Yes

Session Max Lifetime: 1440

Opcode Cache:

Apc: No
Memcached: No
OPcache: Yes
Redis: No
Object Cache:

APC: No
APCu: No
Memcache: No
Memcached: No
Redis: No
WPDB Prefix: wp_ideas_

WP Multisite Mode: No

WP Memory Limit: 40M

Current Memory Usage: 6.380M

Current Memory Usage (real): 2.000M

Pods Network-Wide Activated: No

Pods Install Location: /srv/www/ideas/wp-content/plugins/pods/

Pods Tableless Mode Activated: No

Pods Light Mode Activated: No

Currently Active Theme: Twenty Sixteen

Currently Active Plugins:

Authors Widget: 2.4.8
FV Clone Screen Options: 0.3
Jetpack by WordPress.com: 7.1.1
List all posts by Author, nested Categories and Titles: 2.7.6
My Private Site: 2.14.2
Pods - Custom Content Types and Fields: 2.7.12
Search & Filter: 1.2.11

</details>

## Pods Package Export (helpful!)
{"meta":{"version":"2.7.12","build":1556834099},"pods":{"1947":{"id":1947,"name":"format","label":"Formats","description":"","type":"taxonomy","storage":"meta","object":"","alias":"","fields":[],"show_in_menu":"1","label_singular":"Format","public":"1","show_ui":"1","hierarchical":"1","rewrite":"1","rewrite_with_front":"1","rewrite_hierarchical":"1","capability_type":"default","capability_type_custom":"format","query_var":"0","sort":"0","built_in_post_types_custom_css":"0","built_in_post_types_customize_changeset":"0","built_in_post_types_oembed_cache":"0","built_in_post_types_page":"0","built_in_post_types_pitch":"1","built_in_post_types_post":"1","built_in_post_types_user_request":"0","built_in_post_types_wp_block":"0","built_in_post_types_attachment":"0","menu_location":"default","show_in_nav_menus":"1","show_tagcloud":"1","show_tagcloud_in_edit":"1","show_in_quick_edit":"1","show_admin_column":"1","pfat_enable":"0","pfat_run_outside_loop":"0","pfat_append_archive":"append","rest_enable":"1","read_all":"0","write_all":"0"},"1948":{"id":1948,"name":"industry","label":"Industries","description":"","type":"taxonomy","storage":"meta","object":"","alias":"","fields":[],"show_in_menu":"1","label_singular":"Industry","public":"1","show_ui":"1","hierarchical":"1","rewrite":"1","rewrite_with_front":"1","rewrite_hierarchical":"1","capability_type":"default","capability_type_custom":"industry","query_var":"0","sort":"0","built_in_post_types_custom_css":"0","built_in_post_types_customize_changeset":"0","built_in_post_types_oembed_cache":"0","built_in_post_types_page":"0","built_in_post_types_post":"1","built_in_post_types_user_request":"0","built_in_post_types_wp_block":"0","built_in_post_types_attachment":"0","menu_location":"default","show_in_nav_menus":"1","show_tagcloud":"1","show_tagcloud_in_edit":"1","show_in_quick_edit":"1","show_admin_column":"1","pfat_enable":"0","pfat_run_outside_loop":"0","pfat_append_archive":"append","rest_enable":"1","read_all":"0","write_all":"0","built_in_post_types_pitch":"1"},"1926":{"id":1926,"name":"pitch","label":"Pitches","description":"","type":"post_type","storage":"meta","object":"","alias":"","fields":{"concept_title":{"id":1936,"name":"concept_title","label":"Concept Title","description":"","help":"","class":"","type":"text","weight":0,"pick_object":"","pick_val":"","sister_id":"","required":"0","text_allow_shortcode":"0","text_allow_html":"0","text_allowed_html_tags":"strong em a ul ol li b i","text_max_length":"255","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","text_repeatable":"0","text_placeholder":""},"date_submitted":{"id":1928,"name":"date_submitted","label":"Date Submitted","description":"","help":"","class":"","type":"date","weight":1,"pick_object":"","pick_val":"","sister_id":"","required":"0","date_type":"format","date_format":"mdy","date_allow_empty":"1","date_html5":"0","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","date_repeatable":"0","date_format_custom":"","date_format_custom_js":""},"platform":{"id":1930,"name":"platform","label":"Platform","description":"","help":"","class":"","type":"pick","weight":2,"pick_object":"custom-simple","pick_val":"","sister_id":"","pick_custom":"tv\ndigital\nevent","required":"0","pick_format_type":"multi","pick_format_single":"dropdown","pick_format_multi":"checkbox","pick_allow_add_new":"1","pick_taggable":"0","pick_show_icon":"1","pick_show_edit_link":"1","pick_show_view_link":"1","pick_limit":"0","pick_user_role":[],"pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","pick_select_text":"","pick_table_id":"","pick_table_index":"","pick_display":"","pick_where":"","pick_orderby":"","pick_groupby":""},"pitch_status":{"id":1933,"name":"pitch_status","label":"Pitch Status","description":"","help":"","class":"","type":"pick","weight":3,"pick_object":"custom-simple","pick_val":"","sister_id":"","pick_custom":"Composing\nPitched\nSold\nDead","required":"1","pick_format_type":"single","pick_format_single":"dropdown","pick_format_multi":"checkbox","pick_allow_add_new":"1","pick_taggable":"0","pick_show_icon":"1","pick_show_edit_link":"1","pick_show_view_link":"1","pick_limit":"0","pick_user_role":[],"pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","pick_select_text":"","pick_table_id":"","pick_table_index":"","pick_display":"","pick_where":"","pick_orderby":"","pick_groupby":""},"concept_body":{"id":1937,"name":"concept_body","label":"Concept Body","description":"","help":"","class":"","type":"wysiwyg","weight":4,"pick_object":"","pick_val":"","sister_id":"","required":"0","wysiwyg_editor":"tinymce","wysiwyg_media_buttons":"1","wysiwyg_oembed":"0","wysiwyg_wptexturize":"1","wysiwyg_convert_chars":"1","wysiwyg_wpautop":"1","wysiwyg_allow_shortcode":"0","pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","wysiwyg_repeatable":"0","wysiwyg_allowed_html_tags":""}},"show_in_menu":"0","label_singular":"Pitch","public":"1","show_ui":"1","supports_title":"1","supports_editor":"0","publicly_queryable":"1","exclude_from_search":"0","capability_type":"post","capability_type_custom":"pitch","capability_type_extra":"1","has_archive":"0","hierarchical":"1","rewrite":"1","rewrite_with_front":"1","rewrite_feeds":"0","rewrite_pages":"1","query_var":"1","can_export":"1","default_status":"draft","supports_author":"1","supports_thumbnail":"0","supports_excerpt":"0","supports_trackbacks":"0","supports_custom_fields":"0","supports_comments":"0","supports_revisions":"0","supports_page_attributes":"1","supports_post_formats":"0","supports_jetpack_publicize":"0","supports_jetpack_markdown":"0","built_in_taxonomies_category":"0","built_in_taxonomies_link_category":"0","built_in_taxonomies_post_tag":"1","show_in_nav_menus":"1","show_in_admin_bar":"1","pfat_enable":"1","pfat_run_outside_loop":"0","pfat_append_single":"replace","pfat_filter_single":"the_content","pfat_append_archive":"append","pfat_filter_archive":"the_content","rest_enable":"1","read_all":"0","write_all":"0","pfat_single":"Pitches Template","built_in_taxonomies_format":"1","built_in_taxonomies_industry":"1","built_in_taxonomies_specific_concept":"1"},"2007":{"id":2007,"name":"post","label":"Post","description":"","type":"post_type","storage":"meta","object":"post","alias":"","fields":{"platform":{"id":2008,"name":"platform","label":"Platform","description":"","help":"","class":"","type":"pick","weight":0,"pick_object":"custom-simple","pick_val":"","sister_id":"","required":"1","pick_format_type":"multi","pick_format_single":"dropdown","pick_format_multi":"checkbox","pick_allow_add_new":"1","pick_taggable":"0","pick_show_icon":"1","pick_show_edit_link":"1","pick_show_view_link":"1","pick_limit":"0","pick_user_role":[],"pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","pick_custom":"tv\ndigital\nevent","pick_select_text":"","pick_table_id":"","pick_table_index":"","pick_display":"","pick_where":"","pick_orderby":"","pick_groupby":""},"pitch_status":{"id":2009,"name":"pitch_status","label":"Pitch Status","description":"","help":"","class":"","type":"pick","weight":1,"pick_object":"custom-simple","pick_val":"","sister_id":"","pick_custom":"Pitched\nSold","required":"1","pick_format_type":"single","pick_format_single":"dropdown","pick_format_multi":"checkbox","pick_allow_add_new":"1","pick_taggable":"0","pick_show_icon":"1","pick_show_edit_link":"1","pick_show_view_link":"1","pick_limit":"0","pick_user_role":[],"pick_post_status":["publish"],"admin_only":"0","restrict_role":"0","restrict_capability":"0","hidden":"0","read_only":"0","roles_allowed":["administrator"],"rest_read":"0","rest_write":"0","rest_pick_response":"array","rest_pick_depth":"2","unique":"0","default_value":"Pitched","pick_select_text":"","pick_table_id":"","pick_table_index":"","pick_display":"","pick_where":"","pick_orderby":"","pick_groupby":""}},"show_in_menu":1,"pfat_enable":"1","pfat_run_outside_loop":"0","pfat_single":"Extended Post Template","pfat_append_single":"prepend","pfat_filter_single":"the_content","pfat_append_archive":"append","pfat_filter_archive":"the_content","rest_enable":"1","read_all":"0","write_all":"0"},"1957":{"id":1957,"name":"specific_concept","label":"Specific Concepts","description":"","type":"taxonomy","storage":"meta","object":"","alias":"","fields":[],"show_in_menu":"1","label_singular":"Specific Concept","public":"1","show_ui":"1","hierarchical":"1","rewrite":"1","rewrite_with_front":"1","rewrite_hierarchical":"1","capability_type":"default","capability_type_custom":"concept","query_var":"0","sort":"0","built_in_post_types_custom_css":"0","built_in_post_types_customize_changeset":"0","built_in_post_types_oembed_cache":"0","built_in_post_types_page":"0","built_in_post_types_pitch":"1","built_in_post_types_post":"1","built_in_post_types_user_request":"0","built_in_post_types_wp_block":"1","built_in_post_types_attachment":"0","menu_location":"default","show_in_nav_menus":"1","show_tagcloud":"1","show_tagcloud_in_edit":"1","show_in_quick_edit":"1","show_admin_column":"0","pfat_enable":"0","pfat_run_outside_loop":"0","pfat_append_archive":"append","rest_enable":"1","read_all":"0","write_all":"0"}},"templates":{"Pitches Template":{"id":1929,"name":"Pitches Template","code":"<h3> Concept: {@concept_title}<\/h3>\r\n\r\n<p> Date Submitted: {@date_submitted}<\/p>\r\n<p> Status: {@pitch_status}<\/p>\r\n<p> <\/p>\r\n\r\n<p><strong> Platform(s): <\/strong> {@platform}<\/p>\r\n\r\n<p> {@concept_body}<\/p>","type":"template","slug":"pitches-template","options":{"_edit_lock":"1556815805:19","_edit_last":"19","admin_only":"","restrict_capability":"","capability_allowed":"","pod_reference":"a:1:{s:3:\"pod\";s:5:\"pitch\";}"}},"Extended Post Template":{"id":2031,"name":"Extended Post Template","code":"<p> <strong> Status: <\/strong> {@pitch_status}<\/p>\r\n<p> <strong> Platform(s): <\/strong> {@platform}<\/p>\r\n<p> <hr> <p>","type":"template","slug":"extended-post-template","options":{"_edit_lock":"1556826454:19","_edit_last":"19","admin_only":"","restrict_capability":"","capability_allowed":"","pod_reference":"a:1:{s:3:\"pod\";s:0:\"\";}"}}}}

@issue-label-bot issue-label-bot bot added the Type: Bug label May 2, 2019

@issue-label-bot

This comment has been minimized.

Copy link

commented May 2, 2019

Issue-Label Bot is automatically applying the label Type: Bug to this issue, with a confidence of 0.93. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@JoryHogeveen

This comment has been minimized.

Copy link
Member

commented Jun 5, 2019

@pglewis I believe you were busy with refactoring to React at the moment? I guess the issue above will be fixed once that is done?
I'm getting an internal server error when required fields are not filled.

@pglewis

This comment has been minimized.

Copy link
Collaborator

commented Jun 5, 2019

I thought I already had an issue for this but couldn't find it in a search.

This is probably 2 issues to fix:

  1. I believe we just die() with a message if things don't pass validation on the server-side. That obviously won't play well with Gutenberg, which does ajax saves instead of a form submit and full page load. Server-side validation must always be in place since client-side validation can be bypassed, so we need a fix there.

  2. We need required validation to take place on the client-side for all fields so we can cancel the save and avoid the server round-trip. This should arrive as part of the big 2.8 work going on right now.

@pglewis pglewis changed the title Custom Fields marked Required do not work Custom Fields marked Required do not work with the Gutenberg Editor Jun 5, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.