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

Exclude "content" or "_predefined_fields" from the serialized object #872

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions inc/field.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,6 +966,9 @@ public static function showForTab($params)
function refreshContainer() {
const data = $('#{$html_id}').closest('form').serializeArray().reduce(
function(obj, item) {
if (item.name === "content" || item.name === "_predefined_fields") {
return obj;
}
Comment on lines +969 to +971
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With this,
Fields named content or _predefined_fields are ignored. This means that these fields will not be included in the final object.

However, they can be used in conditions to hide a block.

image

Without this fields, condition can't be check

var multiple_matches = item.name.match(/^(.+)\[\]$/);
if (multiple_matches) {
var name = multiple_matches[1];
Expand Down