Custom Field automatically set to required to fill when it’s not set

Support › MB Custom Post Type › Custom Field automatically set to required to fill when it’s not set

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #49558
    Way LeongWay Leong
    Participant

    Hi everyone, I’m using metabox 5.10.19 and AIO 3.3.5.

    I’m facing some issue where a post field automatically set required => true when i did not set it.

    Weird thing is there is double * like ** on the required mark, I tried deleting it and reimport it. But unfortunately it does not work, have yet to set required => true, just to share here see if anyone facing the same issue?

    #49560
    Way LeongWay Leong
    Participant

    Forgot to mention the ** it’s the required symbol beside the label and I have yet tried to manually set required => false as I believe it might have some bugs

    #49563
    Way LeongWay Leong
    Participant

    Hi, just an update from the previous issue, this bug can be reproduce when 2 custom field groups are connected to 1 same tab in settings page. That specific custom field will automatically validate as Required => True. If I removed 1 custom field group then the custom field will back to normal state of required => False

    #49567
    PeterPeter
    Moderator

    Hello,

    Thanks for reaching out.

    I'm not able to reproduce the issue on my site with two field groups assigned to one tab on a settings page and they have the post field inside.
    Could you please export your field groups to a JSON file and share it with me? I will import field groups to my site and investigate the issue.

    Following the documentation https://docs.metabox.io/extensions/meta-box-builder/#export--import

    #49575
    Way LeongWay Leong
    Participant

    Hi,

    sorry for late reply.

    Here's the exported custom group field (https://sitewide-settings-company-branch-contact-details-1.tiiny.site/sitewide-settings-company-branch-contact-details-1.json)

    I think it's because I'm wrapping multiples cloneable group inside a parent cloneable group, not sure whether I am doing it correctly

    #49582
    PeterPeter
    Moderator

    Hello,

    I don't see any post field in your field group. Could you please recheck this and share 2 field groups that are assigned to one settings page? Or share a screen record of steps you take from the beginning so I can reproduce the issue on my site?

    Thank you.

    #49590
    Way LeongWay Leong
    Participant

    Hi,

    I'll share the 2 field group's code here instead.

    This is the first code:

    {
        "$schema": "https://schemas.metabox.io/field-group.json",
        "custom_settings": {
            "tab_style": {
                "id": "tab_style",
                "key": "tab_style",
                "value": "left"
            },
            "tab_default_active": {
                "id": "tab_default_active",
                "key": "tab_default_active",
                "value": ""
            },
            "tab_remember": {
                "id": "tab_remember",
                "key": "tab_remember",
                "value": false
            }
        },
        "fields": [
            {
                "type": "select",
                "id": "sitewide_primary_company_phone_display_mode",
                "name": "Sitewide - Primary Company - Phone Display Mode",
                "label_description": "Controls how the primary phone contact is displayed on the website",
                "desc": "<div class=\"mb-desc mb-desc--info\"> 📱 Choose how phone contact information should appear on the website. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Use a single phone option for most businesses. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Disabled mode hides all phone-related elements. </div>",
                "options": {
                    "Disabled": "Disabled",
                    "Single Phone (Phone Number Only)": "Single Phone (Phone Number Only)",
                    "Single Phone (Phone Number + WhatsApp)": "Single Phone (Phone Number + WhatsApp)",
                    "Multiple Phones": "Multiple Phones"
                },
                "tab": "phone_number",
                "std": null
            },
            {
                "type": "text",
                "id": "sitewide_primary_company_phone_number",
                "name": "Sitewide - Primary Company - Phone Number",
                "columns": 6,
                "desc": "<div class=\"mb-desc mb-desc--info\"> 📞 Used for click-to-call links. </div> <div class=\"mb-desc mb-desc--tip\"> 🌍 You may format this number for readability (e.g. 016-346 6724). </div> <div class=\"mb-desc mb-desc--warning\"> ⚠️ This number will be publicly visible. </div>",
                "label_description": "Primary phone number displayed on the website",
                "tab": "phone_number",
                "visible": {
                    "type": "visible",
                    "relation": "or",
                    "when": {
                        "sitewide_primary_company_phone_display_mode": [
                            "sitewide_primary_company_phone_display_mode",
                            "=",
                            "Single Phone (Phone Number + WhatsApp)"
                        ],
                        "wbscomrjqri": [
                            "sitewide_primary_company_phone_display_mode",
                            "=",
                            "Single Phone (Phone Number Only)"
                        ]
                    }
                }
            },
            {
                "type": "text",
                "id": "sitewide_primary_company_phone_number_role_label",
                "name": "Sitewide - Primary Company - Phone Number Role / Label",
                "columns": 6,
                "desc": "<div class=\"mb-desc mb-desc--info\"> 🏷 Optional. Displayed next to the WhatsApp button if provided. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Examples: WhatsApp, Sales WhatsApp, Support Chat. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Leave empty if no label is required. </div>",
                "label_description": "Optional label describing the WhatsApp contact",
                "tab": "phone_number",
                "visible": {
                    "type": "visible",
                    "relation": "or",
                    "when": {
                        "sitewide_primary_company_phone_display_mode": [
                            "sitewide_primary_company_phone_display_mode",
                            "=",
                            "Single Phone (Phone Number Only)"
                        ],
                        "8mp5giedmkr": [
                            "sitewide_primary_company_phone_display_mode",
                            "=",
                            "Single Phone (Phone Number + WhatsApp)"
                        ]
                    }
                }
            },
            {
                "type": "text",
                "id": "sitewide_primary_company_whatsapp_number",
                "name": "Sitewide - Primary Company - WhatsApp Number",
                "columns": 6,
                "desc": "<div class=\"mb-desc mb-desc--info\"> 💬 Used to generate WhatsApp chat links. </div> <div class=\"mb-desc mb-desc--tip\"> 🔢 Enter digits only, without spaces or symbols. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Example format: 60163466724 </div>",
                "label_description": "WhatsApp-enabled number used for chat links",
                "tab": "phone_number",
                "visible": [
                    "sitewide_primary_company_phone_display_mode",
                    "Single Phone (Phone Number + WhatsApp)"
                ]
            },
            {
                "type": "text",
                "id": "sitewide_primary_company_whatsapp_number_role_or_label",
                "name": "Sitewide - Primary Company - WhatsApp Number Role or Label",
                "columns": 6,
                "desc": "<div class=\"mb-desc mb-desc--info\"> 🏷 Optional. Displayed next to the WhatsApp button if provided. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Examples: WhatsApp, Sales WhatsApp, Support Chat. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Leave empty if no label is required. </div>",
                "label_description": "Optional label describing the WhatsApp contact",
                "tab": "phone_number",
                "visible": [
                    "sitewide_primary_company_phone_display_mode",
                    "Single Phone (Phone Number + WhatsApp)"
                ]
            },
            {
                "type": "group",
                "id": "sitewide_primary_company_group_multiple_phone_numbers",
                "name": "Sitewide - Primary Company Group - Multiple Phone Numbers",
                "clone": true,
                "clone_empty_start": true,
                "sort_clone": true,
                "clone_default": true,
                "collapsible": true,
                "group_title": "Contact {#}",
                "clone_as_multiple": true,
                "tab": "phone_number",
                "min_clone": 0,
                "max_clone": 0,
                "fields": [
                    {
                        "type": "select",
                        "id": "sitewide_primary_company_group_phone_display_mode",
                        "name": "Sitewide - Primary Company Group - Phone Display Mode",
                        "label_description": "Controls how the phone contact is displayed on the website",
                        "desc": "<div class=\"mb-desc mb-desc--info\"> 📱 Choose how phone contact information should appear on the website. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Use a single phone option for most businesses. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Disabled mode hides all phone-related elements. </div>",
                        "options": {
                            "Phone Number Only": "Phone Number Only",
                            "Phone Number + WhatsApp": "Phone Number + WhatsApp"
                        },
                        "std": null
                    },
                    {
                        "type": "text",
                        "id": "sitewide_primary_company_group_phone_number",
                        "name": "Sitewide - Primary Company Group - Phone Number",
                        "columns": 6,
                        "desc": "<div class=\"mb-desc mb-desc--info\"> 📞 Used for click-to-call links. </div> <div class=\"mb-desc mb-desc--tip\"> 🌍 You may format this number for readability (e.g. 016-346 6724). </div> <div class=\"mb-desc mb-desc--warning\"> ⚠️ This number will be publicly visible. </div>",
                        "label_description": "Additional phone number displayed on the website",
                        "visible": [
                            "sitewide_primary_company_group_phone_display_mode",
                            "Phone Number + WhatsApp"
                        ]
                    },
                    {
                        "type": "text",
                        "id": "sitewide_primary_company_group_phone_number_role_label",
                        "name": "Sitewide - Primary Company Group - Phone Number Role or Label",
                        "columns": 6,
                        "desc": "<div class=\"mb-desc mb-desc--info\"> 🏷 Optional. Displayed next to the phone number if provided. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Examples: Reception, General Line, Office. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Leave empty if no label is required. </div>",
                        "label_description": "Optional label describing the purpose of this phone number",
                        "visible": [
                            "sitewide_primary_company_group_phone_display_mode",
                            "Phone Number + WhatsApp"
                        ]
                    },
                    {
                        "type": "text",
                        "id": "sitewide_primary_company_group_whatsapp_number",
                        "name": "Sitewide - Primary Company Group - WhatsApp Number",
                        "columns": 6,
                        "desc": "<div class=\"mb-desc mb-desc--info\"> 💬 Used to generate WhatsApp chat links. </div> <div class=\"mb-desc mb-desc--tip\"> 🔢 Enter digits only, without spaces or symbols. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Example format: 60163466724 </div>",
                        "label_description": "WhatsApp-enabled number used for chat links",
                        "visible": [
                            "sitewide_primary_company_group_phone_display_mode",
                            "Phone Number + WhatsApp"
                        ]
                    },
                    {
                        "type": "text",
                        "id": "sitewide_primary_company_group_whatsapp_number_role_label",
                        "name": "Sitewide - Primary Company Group - WhatsApp Number Role or Label",
                        "columns": 6,
                        "desc": "<div class=\"mb-desc mb-desc--info\"> 🏷 Optional. Displayed next to the WhatsApp button if provided. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Examples: WhatsApp, Sales WhatsApp, Support Chat. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Leave empty if no label is required. </div>",
                        "label_description": "Optional label describing the WhatsApp contact",
                        "visible": [
                            "sitewide_primary_company_group_phone_display_mode",
                            "Phone Number + WhatsApp"
                        ]
                    }
                ],
                "visible": [
                    "sitewide_primary_company_phone_display_mode",
                    "Multiple Phones"
                ]
            },
            {
                "type": "select",
                "id": "sitewide_primary_company_email_display_mode",
                "name": "Sitewide - Primary Company - Email Display Mode",
                "label_description": "Controls how the primary email contact is displayed on the website",
                "desc": "<div class=\"mb-desc mb-desc--info\"> 📨 Choose how email contact information is shown on the website. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Use “Single Email” for most small to medium websites. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Disabled mode hides all email-related elements. </div>",
                "options": {
                    "Disabled": "Disabled",
                    "Single Email": "Single Email",
                    "Multiple Emails": "Multiple Emails"
                },
                "tab": "e_mail",
                "std": null
            },
            {
                "type": "text",
                "id": "sitewide_primary_company_primary_email_address",
                "name": "Sitewide - Primary Company - Primary Email Address",
                "label_description": "Primary email address for enquiries and correspondence",
                "desc": "<div class=\"mb-desc mb-desc--info\"> 📧 Used for contact forms and direct email links. </div> <div class=\"mb-desc mb-desc--warning\"> ⚠️ This email address may be publicly visible. </div> <div class=\"mb-desc mb-desc--danger\"> 🚫 Avoid using personal email addresses. </div>",
                "columns": 6,
                "tab": "e_mail",
                "visible": [
                    "sitewide_primary_company_email_display_mode",
                    "Single Email"
                ]
            },
            {
                "type": "text",
                "id": "sitewide_primary_company_primary_email_role_label",
                "name": "Sitewide - Primary Company - Primary Email Role or Label",
                "label_description": "Primary email address for enquiries and correspondence",
                "desc": "<div class=\"mb-desc mb-desc--info\"> 📧 Used for contact forms and direct email links. </div> <div class=\"mb-desc mb-desc--warning\"> ⚠️ This email address may be publicly visible. </div> <div class=\"mb-desc mb-desc--danger\"> 🚫 Avoid using personal email addresses. </div>",
                "columns": 6,
                "tab": "e_mail",
                "visible": [
                    "sitewide_primary_company_email_display_mode",
                    "Single Email"
                ]
            },
            {
                "type": "group",
                "id": "sitewide_primary_company_group_multiple_emails",
                "name": "Sitewide - Primary Company Group - Multiple Emails",
                "clone": true,
                "clone_empty_start": true,
                "sort_clone": true,
                "collapsible": true,
                "group_title": "Email {#}",
                "clone_default": true,
                "clone_as_multiple": true,
                "tab": "e_mail",
                "min_clone": 0,
                "max_clone": 0,
                "fields": [
                    {
                        "type": "text",
                        "id": "sitewide_primary_company_group_email_address",
                        "name": "Sitewide - Primary Company Group - Email Address",
                        "label_description": "Primary email address for enquiries and correspondence",
                        "desc": "<div class=\"mb-desc mb-desc--info\"> 📧 Used for contact forms and direct email links. </div> <div class=\"mb-desc mb-desc--warning\"> ⚠️ This email address may be publicly visible. </div> <div class=\"mb-desc mb-desc--danger\"> 🚫 Avoid using personal email addresses. </div>",
                        "columns": 6
                    },
                    {
                        "type": "text",
                        "id": "sitewide_primary_company_group_email_role_label",
                        "name": "Sitewide - Primary Company Group - Email Role or Label",
                        "columns": 6,
                        "label_description": "Primary email address for enquiries and correspondence",
                        "desc": "<div class=\"mb-desc mb-desc--info\"> 📧 Used for contact forms and direct email links. </div> <div class=\"mb-desc mb-desc--warning\"> ⚠️ This email address may be publicly visible. </div> <div class=\"mb-desc mb-desc--danger\"> 🚫 Avoid using personal email addresses. </div>"
                    }
                ],
                "visible": [
                    "sitewide_primary_company_email_display_mode",
                    "Multiple Emails"
                ]
            },
            {
                "type": "select",
                "id": "sitewide_primary_company_google_map_display_mode",
                "name": "Sitewide - Primary Company - Google Map Display Mode",
                "desc": "<div class=\"mb-desc mb-desc--info\"> 🗺 Choose how the HQ location should be displayed on Google Maps. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Select the simplest option that accurately represents your location. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Selecting “Disabled” will hide all map-related elements. </div>",
                "label_description": "Controls how the primary company location is shown on Google Maps",
                "options": {
                    "Disabled": "Disabled",
                    "Company Name": "Company Name",
                    "Company Full Address": "Company Full Address",
                    "Latitude & Longitude": "Latitude & Longitude"
                },
                "tab": "primary_hq_company_location",
                "std": null
            },
            {
                "type": "text",
                "id": "sitewide_primary_company_company_name_google_map",
                "name": "Sitewide - Primary Company - Company Name (Google Map)",
                "label_description": "Company name used for Google Maps search",
                "desc": "<div class=\"mb-desc mb-desc--info\"> 📍 Used to locate the business directly by name on Google Maps. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Best for well-established businesses with verified listings. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Must match the name used on Google Maps. </div>",
                "tab": "primary_hq_company_location",
                "visible": [
                    "sitewide_primary_company_google_map_display_mode",
                    "Company Name"
                ]
            },
            {
                "type": "text",
                "id": "sitewide_primary_company_latitude_longitude_google_map",
                "name": "Sitewide - Primary Company - Latitude & Longitude",
                "label_description": "Geographic coordinates for precise map positioning",
                "desc": "<div class=\"mb-desc mb-desc--info\"> 📍 Provides exact location accuracy on Google Maps. </div> <div class=\"mb-desc mb-desc--tip\"> 🔢 Format example: 3.1390, 101.6869 </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Incorrect values may cause the map to display incorrectly. </div>",
                "tab": "primary_hq_company_location",
                "visible": [
                    "sitewide_primary_company_google_map_display_mode",
                    "Latitude & Longitude"
                ]
            },
            {
                "type": "textarea",
                "id": "sitewide_primary_company_company_full_address_google_map",
                "name": "Sitewide - Primary Company - Company Full Address",
                "label_description": "Company full address used for Google Maps search",
                "desc": "<div class=\"mb-desc mb-desc--info\"> 📍 Used to locate the business directly by name on Google Maps. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Best for well-established businesses with verified listings. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Must match the name used on Google Maps. </div>",
                "tab": "primary_hq_company_location",
                "visible": [
                    "sitewide_primary_company_google_map_display_mode",
                    "!=",
                    "Disabled"
                ]
            },
            {
                "type": "url",
                "id": "sitewide_primary_company_google_maps_external_link",
                "name": "Sitewide - Primary Company - Google Maps External Link",
                "label_description": "Geographic coordinates for precise map positioning",
                "desc": "<div class=\"mb-desc mb-desc--info\"> 📍 Provides exact location accuracy on Google Maps. </div> <div class=\"mb-desc mb-desc--tip\"> 🔢 Format example: 3.1390, 101.6869 </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Incorrect values may cause the map to display incorrectly. </div>",
                "tab": "primary_hq_company_location",
                "visible": [
                    "sitewide_primary_company_google_map_display_mode",
                    "!=",
                    "Disabled"
                ]
            }
        ],
        "id": "sitewide-settings-primary-company-contact-details",
        "modified": 1767353217,
        "priority": "high",
        "settings_pages": [
            "sitewide-settings"
        ],
        "style": "default",
        "tab": "📞 Contact Information",
        "tab_remember": false,
        "tab_style": "left",
        "tabs": {
            "phone_number": {
                "label": "Phone Number",
                "icon": "dashicons-phone"
            },
            "e_mail": {
                "label": "E-mail",
                "icon": "dashicons-email"
            },
            "primary_hq_company_location": {
                "label": "Company Location",
                "icon": "dashicons-location"
            }
        },
        "title": "⚙️ Sitewide Settings – Primary Company Contact Details",
        "validation": {
            "rules": []
        }
    }

    This is the second code:

    {
        "$schema": "https://schemas.metabox.io/field-group.json",
        "custom_settings": {
            "tab_style": {
                "id": "tab_style",
                "key": "tab_style",
                "value": "default"
            },
            "tab_default_active": {
                "id": "tab_default_active",
                "key": "tab_default_active",
                "value": ""
            },
            "tab_remember": {
                "id": "tab_remember",
                "key": "tab_remember",
                "value": false
            }
        },
        "fields": [
            {
                "type": "group",
                "id": "sitewide_company_branch_group",
                "name": "Sitewide - Company Branch Group",
                "clone": true,
                "clone_empty_start": true,
                "sort_clone": true,
                "collapsible": true,
                "group_title": "Branch {#}",
                "clone_default": true,
                "clone_as_multiple": true,
                "label_description": "Information specific to an individual company branch, including contact details and physical location. These settings apply only to this branch and do not affect the primary company information.",
                "desc": "<div class=\"mb-desc mb-desc--info mb-desc--compact\"> 📌 End of Branch Information section. </div> <div class=\"mb-desc mb-desc--tip mb-desc--compact\"> 💡 Each branch is managed independently from the primary company. </div>",
                "min_clone": 0,
                "max_clone": 0,
                "fields": [
                    {
                        "type": "group",
                        "id": "sitewide_company_branch_group_phone_number_section",
                        "name": "Sitewide - Company Branch Group - Phone Number Section",
                        "clone": true,
                        "clone_empty_start": true,
                        "sort_clone": true,
                        "clone_default": true,
                        "clone_as_multiple": true,
                        "collapsible": true,
                        "group_title": "Branch Contact {#}",
                        "desc": "<div class=\"mb-desc mb-desc--info mb-desc--compact\"> 📌 End of Branch Phone & WhatsApp section. </div> <div class=\"mb-desc mb-desc--tip mb-desc--compact\"> 💡 Leave this section disabled if the branch does not handle calls or chats directly. </div>",
                        "label_description": "Phone and WhatsApp contact details for this branch. Used when the branch has its own direct contact numbers separate from the primary company.",
                        "min_clone": 0,
                        "max_clone": 0,
                        "fields": [
                            {
                                "type": "select",
                                "id": "sitewide_company_branch_group_phone_display_mode",
                                "name": "Sitewide - Company Branch Group - Phone Display Mode",
                                "options": {
                                    "Phone Number Only": "Phone Number Only",
                                    "Phone Number + WhatsApp": "Phone Number + WhatsApp"
                                },
                                "label_description": "Controls how phone and WhatsApp contact information is displayed for this branch.",
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 📱 Choose how phone and WhatsApp contact details should appear for this branch. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Use Disabled if this branch should not display phone contact details. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Disabled mode hides all phone and WhatsApp information for this branch. </div>",
                                "std": null
                            },
                            {
                                "type": "text",
                                "id": "sitewide_company_branch_group_phone_number",
                                "name": "Sitewide - Company Branch Group - Phone Number",
                                "columns": 6,
                                "label_description": "Phone number for this branch.",
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 📞 Used for click-to-call links specific to this branch. </div> <div class=\"mb-desc mb-desc--tip\"> 🌍 Formatting is allowed for readability (e.g. 03-1234 5678). </div> <div class=\"mb-desc mb-desc--warning\"> ⚠️ This number will be publicly visible. </div>",
                                "visible": [
                                    "sitewide_company_branch_group_phone_display_mode",
                                    "Phone Number + WhatsApp"
                                ]
                            },
                            {
                                "type": "text",
                                "id": "sitewide_company_branch_group_phone_number_role_or_label",
                                "name": "Sitewide - Company Branch Group - Phone Number Role or Label",
                                "columns": 6,
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 🏷 Optional. Displayed next to the phone number if provided. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Examples: Reception, Sales, Branch Office. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Leave empty if no label is required. </div>",
                                "label_description": "Optional label describing the purpose of this phone number.",
                                "visible": [
                                    "sitewide_company_branch_group_phone_display_mode",
                                    "Phone Number + WhatsApp"
                                ]
                            },
                            {
                                "type": "text",
                                "id": "sitewide_company_branch_group_whatsapp_number",
                                "name": "Sitewide - Company Branch Group - WhatsApp Number",
                                "columns": 6,
                                "label_description": "WhatsApp-enabled phone number for this branch.",
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 💬 Used to generate a WhatsApp chat link for this branch. </div> <div class=\"mb-desc mb-desc--tip\"> 🔢 Enter digits only, without spaces or symbols. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Example format: 60123456789 </div>",
                                "visible": [
                                    "sitewide_company_branch_group_phone_display_mode",
                                    "Phone Number + WhatsApp"
                                ]
                            },
                            {
                                "type": "text",
                                "id": "sitewide_company_branch_group_whatsapp_number_role_label",
                                "name": "Sitewide - Company Branch Group - WhatsApp Number Role or Label",
                                "columns": 6,
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 🏷 Optional. Displayed next to the WhatsApp button if provided. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Examples: WhatsApp, Sales Chat, Support Chat. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Leave empty if no label is required. </div>",
                                "label_description": "Optional label describing the WhatsApp contact for this branch.",
                                "visible": [
                                    "sitewide_company_branch_group_phone_display_mode",
                                    "Phone Number + WhatsApp"
                                ]
                            }
                        ]
                    },
                    {
                        "type": "group",
                        "id": "sitewide_company_branch_group_email_section",
                        "name": "Sitewide - Company Branch Group - Email Section",
                        "clone": true,
                        "clone_empty_start": true,
                        "sort_clone": true,
                        "clone_default": true,
                        "clone_as_multiple": true,
                        "label_description": "Email contact information for this branch. Used when enquiries for this location should be handled separately from the primary company email.",
                        "collapsible": true,
                        "group_title": "Branch Email {#}",
                        "desc": "<div class=\"mb-desc mb-desc--info mb-desc--compact\"> 📌 End of Branch Email Contact section. </div> <div class=\"mb-desc mb-desc--tip mb-desc--compact\"> 💡 Use branch emails only when enquiries should not go to the main office. </div>",
                        "min_clone": 0,
                        "max_clone": 0,
                        "fields": [
                            {
                                "type": "email",
                                "id": "sitewide_company_branch_email_address",
                                "name": "Sitewide - Company Branch - Email Address",
                                "columns": 6,
                                "label_description": "Email address for this branch.",
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 📧 Used for enquiries related specifically to this branch. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Examples: [email protected], [email protected]. </div> <div class=\"mb-desc mb-desc--warning\"> ⚠️ This email address will be publicly visible. </div>"
                            },
                            {
                                "type": "text",
                                "id": "sitewide_company_branch_email_role_label",
                                "name": "Sitewide - Company Branch - Email Role or Label",
                                "columns": 6,
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 🏷 Optional. Displayed next to the email address if provided. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Examples: General Enquiries, Sales, Branch Office. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Leave empty if no label is required. </div>",
                                "label_description": "Optional label describing the purpose of this email address."
                            }
                        ]
                    },
                    {
                        "type": "group",
                        "id": "sitewide_company_branch_group_location_section",
                        "name": "Sitewide - Company Branch Group - Location Section",
                        "collapsible": true,
                        "group_title": "Branch Location {#}",
                        "label_description": "Physical address and map information for this branch. Used to display the branch location on maps, contact pages, and direction links.",
                        "desc": "<div class=\"mb-desc mb-desc--info mb-desc--compact\"> 📌 End of Branch Location section. </div> <div class=\"mb-desc mb-desc--tip mb-desc--compact\"> 🗺 This information is used for maps, directions, and contact pages. </div>",
                        "fields": [
                            {
                                "type": "select",
                                "id": "sitewide_company_branch_google_map_display_mode",
                                "name": "Sitewide - Company Branch - Google Map Display Mode",
                                "options": {
                                    "Company Name": "Company Name",
                                    "Company Full Address": "Company Full Address",
                                    "Latitude & Longitude": "Latitude & Longitude"
                                },
                                "label_description": "Controls whether this branch’s location is displayed on Google Maps.",
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 🗺 Controls the visibility of the branch location on maps. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Enable this for physical branches open to visitors. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Disabled mode hides all map and address information for this branch. </div>",
                                "std": null
                            },
                            {
                                "type": "text",
                                "id": "sitewide_company_branch_company_name_google_map",
                                "name": "Sitewide - Company Branch - Company Name (Google Map)",
                                "label_description": "Branch name displayed on Google Maps.",
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 🏢 Used as the location name shown on Google Maps. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Usually includes the company name followed by the branch name. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ This text may be publicly visible on map embeds. </div>",
                                "visible": [
                                    "sitewide_company_branch_group_location_section",
                                    "Company Name"
                                ]
                            },
                            {
                                "type": "text",
                                "id": "sitewide_company_branch_latitude_longitude",
                                "name": "Sitewide - Company Branch - Latitude & Longitude",
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 📍 Used to pinpoint the branch location accurately on maps. </div> <div class=\"mb-desc mb-desc--tip\"> 🗺 Enter latitude and longitude from Google Maps for precise placement. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Required for accurate map display and location pins. </div>",
                                "label_description": "Geographic coordinates for the exact branch location.",
                                "visible": [
                                    "sitewide_company_branch_group_location_section",
                                    "Latitude & Longitude"
                                ]
                            },
                            {
                                "type": "textarea",
                                "id": "sitewide_company_branch_company_full_address",
                                "name": "Sitewide - Company Branch - Company Full Address",
                                "label_description": "Complete physical address of this branch.",
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 📍 Displayed as the branch’s physical address. </div> <div class=\"mb-desc mb-desc--tip\"> 💡 Include unit number, street, city, state, and postcode. </div> <div class=\"mb-desc mb-desc--warning\"> ⚠️ This address will be publicly visible if map display is enabled. </div>"
                            },
                            {
                                "type": "url",
                                "id": "sitewide_company_branch_google_maps_external_link",
                                "name": "Sitewide - Company Branch - Google Maps External Link",
                                "desc": "<div class=\"mb-desc mb-desc--info\"> 🔗 Allows users to open directions in Google Maps. </div> <div class=\"mb-desc mb-desc--tip\"> 🧭 Useful for “Get Directions” buttons. </div> <div class=\"mb-desc mb-desc--warning mb-desc--compact\"> ⚠️ Leave empty if no external map link is required. </div>",
                                "label_description": "Direct link to this branch location on Google Maps."
                            }
                        ]
                    }
                ]
            }
        ],
        "id": "sitewide-settings-company-branch-contact-details",
        "modified": 1767027067,
        "priority": "high",
        "settings_pages": [
            "sitewide-settings"
        ],
        "style": "default",
        "tab": "📞 Contact Information (Branch)",
        "tab_remember": false,
        "title": "⚙️ Sitewide Settings – Company Branch Contact Details",
        "validation": {
            "rules": {
                "sitewide_primary_company_primary_email_role_label": {
                    "required": true
                }
            }
        }
    }

    I'm not sure whether my second code is done correctly because when I turn off 2nd code on my website the error will be gone.

    #49591
    Way LeongWay Leong
    Participant

    I have recorded a video too, just in case my explanation is not clear enough

    When the field group "⚙️ Sitewide Settings – Company Branch Contact Details" is activated then the error is showing on that specific field.

    #49592
    Way LeongWay Leong
    Participant
    #49595
    PeterPeter
    Moderator

    Hello,

    I see there is a validation "Required" in the JSON export file

    
        "validation": {
            "rules": {
                "sitewide_primary_company_primary_email_role_label": {
                    "required": true
                }
            }
        }
    

    Please edit the field, remove this setting and recheck the issue. Screenshot https://imgur.com/rqvNhaf
    Refer to the documentation https://docs.metabox.io/validation/

    #49598
    Way LeongWay Leong
    Participant

    Hi Peter,

    I saw the second code do have

        
    "validation": {
            "rules": {
                "sitewide_primary_company_primary_email_role_label": {
                    "required": true
                }
            }
        }
    

    the custom field "sitewide_primary_company_primary_email_role_label" shouldn't be in the second code, but in the custom field settings, the custom field did not set any validation on it (https://prnt.sc/cIp9OJ6AyL9D)

    But the field is showing required (https://prnt.sc/yJoWi2DPDA9W)

    #49599
    Way LeongWay Leong
    Participant

    Hi Peter,

    Just an update, I manually edit the json file using VS Code then reimport the Metabox, now it's working.

    But if I do it via the dashboard I couldn't see any validation is added.

    #49815
    dwcouchdwcouch
    Participant

    This may be related;
    I just noticed two separate methods for specifying a custom field as required.
    1. At the top of the UX in the right of the panel header there are 2 toggles. One for 'Required', the other for 'Cloneable'.
    2. The second instance is in the Component Panel 'Validation'. If I open this, by default the Required rule set is selected.

    These seem to work independently but are redundant. If both are set we see two **
    I came to report a bug - but found this post.
    As always - you guys rock. Thank you.
    ~D

Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.