AdvancedCustomFields / AdvancedCustomFields/acf

Frontend forms - creating taxonomy submits form

Open
#635 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
945
Forks
197
PR merge metrics
No merged PRs in 30d

Description

Hello, I am trying using frontend forms and it works well. However I have stumbled upon some strange behavior with creating taxonomy + required input combo.

When there is only taxonomy field and I am trying to add new term on frontend everything works fine. When there is another required field, e.g. some input, creating new term sends second request which tries to submit whole form.

https://user-images.githubusercontent.com/2657856/161590958-1df38a11-b21e-46a3-9d98-8d1062eba4a8.mov

Here is the exported fields group:

[
    {
        "key": "group_624b1a511114d",
        "title": "Error test",
        "fields": [
            {
                "key": "field_624b1a70171aa",
                "label": "Input",
                "name": "input",
                "type": "text",
                "instructions": "",
                "required": 1,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "default_value": "",
                "placeholder": "",
                "prepend": "",
                "append": "",
                "maxlength": ""
            },
            {
                "key": "field_624b1a5d171a9",
                "label": "Taxonomy",
                "name": "taxonomy",
                "type": "taxonomy",
                "instructions": "",
                "required": 0,
                "conditional_logic": 0,
                "wrapper": {
                    "width": "",
                    "class": "",
                    "id": ""
                },
                "taxonomy": "post_tag",
                "field_type": "multi_select",
                "allow_null": 1,
                "add_term": 1,
                "save_terms": 1,
                "load_terms": 1,
                "return_format": "id",
                "multiple": 0
            }
        ],
        "location": [
            [
                {
                    "param": "page",
                    "operator": "==",
                    "value": "6"
                }
            ]
        ],
        "menu_order": 0,
        "position": "normal",
        "style": "default",
        "label_placement": "top",
        "instruction_placement": "label",
        "hide_on_screen": "",
        "active": true,
        "description": "",
        "show_in_rest": 0
    }
]

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with the exported field group: a required text input plus a taxonomy field with add_term enabled on a frontend form. Inspect the frontend taxonomy term-creation request and form submission behavior; done means adding a taxonomy term does not submit the whole form or trigger required-field validation.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.