Skip to content

[BUG] One-page input double-prompts for {{FIELD:...}} variables #1184

@cdelog

Description

@cdelog

AI Disclaimer: I used AWS Kiro to help debug and trace the root cause through source. I validate the content below as accurate.

Describe the bug

{{FIELD:...}} in a Template choice with one-page input enabled: field shows in the form with vault suggestions, user enters a value, submits. QuickAdd then prompts again with a separate dialog for the same field. The one-page value is lost.

To Reproduce

  1. Open Obsidian, go to QuickAdd settings
  2. Toggle ON "One-page input for choices"
  3. Create a Template choice pointing to a template with {{FIELD:People}} in frontmatter
  4. Trigger the choice
  5. One-page modal appears with a "People" field showing vault suggestions
  6. Enter a value, submit the form
  7. A second individual prompt appears asking for "People" again

Remove {{FIELD:People}}, everything else works. VALUE, VDATE, dropdowns all fine.

Expected behavior

The value entered in the one-page form should be used by the runtime formatter without prompting again.

Obsidian Debug Info (required for bug reports)

SYSTEM INFO:
	Obsidian version: 1.12.7
	Installer version: 1.8.10
	Operating system: Windows 11 Enterprise 10.0.22631
	Login status: logged in
	Language: en
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Base theme: light
	Community theme: AnuPpuccin 1.5.0
	Snippets enabled: 3
	Restricted mode: off
	Plugins installed: 36
	Plugins enabled: 35
		1: Mind Map v1.1.0
		2: Copy button for code blocks v0.1.0
		3: Editor Syntax Highlight v0.1.3
		4: Iconize v2.14.7
		5: Diagrams v1.5.4
		6: Paste URL into selection v1.11.4
		7: Dataview v0.5.68
		8: Excalidraw v2.22.3
		9: CardBoard v0.7.9
		10: Pandoc Plugin v0.4.1
		11: Sort & Permute lines v0.7.0
		12: Text Generator v0.8.7
		13: Calendar v1.5.10
		14: Periodic Notes v0.0.17
		15: Tag Wrangler v0.6.4
		16: Note Refactor v1.8.2
		17: Hover Editor v0.11.29
		18: Hotkeys++ v0.2.7
		19: Text Format v3.1.0
		20: Workspaces Plus v0.3.3
		21: Quick Switcher++ v6.1.2
		22: Advanced Tables v0.22.2
		23: Icons v0.3.0
		24: Shell commands v0.23.0
		25: Callout Manager v1.1.1
		26: Spoiler Block v1.0.0
		27: Tasks v8.0.0
		28: Banners v1.3.3
		29: Homepage v4.4.0
		30: Style Settings v1.0.9
		31: Highlightr v1.2.2
		32: Various Complements v11.2.0
		33: BRAT v2.0.4
		34: Auralite v1.5.0
		35: QuickAdd v2.12.0

Screenshots

N/A - no visual error. The bug manifests as a second prompt dialog appearing after the one-page form is submitted.

Environment (please complete the following information):

  • Obsidian version: 1.12.7
  • QuickAdd version: 2.12.0
  • Operating system: Windows 11 Enterprise
  • Debug info: No console errors. Silent failure.
  • Other plugins enabled: Dataview v0.5.68 (provides field suggestions)
  • Theme: AnuPpuccin 1.5.0

Console Logs

No errors. The bug is a silent failure - the one-page form submits successfully, but the runtime formatter doesn't find the stored value and falls through to a second prompt.

Additional context

Root cause: Key mismatch between preflight and runtime.

  • RequirementCollector.suggestForField() registers requirement with id: "People"
  • One-page form stores result in choiceExecutor.variables as key "People"
  • Runtime replaceFieldVarInString() looks up "FIELD:People" via getFieldVariableKey() which prepends FIELD_VARIABLE_PREFIX
  • Not found → prompts again
// RequirementCollector stores as:
id: variableName  // "People"

// Runtime looks up as:
`${FIELD_VARIABLE_PREFIX}${fieldSpecifier}`  // "FIELD:People"

Suggested fix (validated locally):

Make RequirementCollector.suggestForField use the "FIELD:" prefix on the id, matching what the runtime expects:

protected async suggestForField(variableName: string): Promise<string> {
    const key = `FIELD:${variableName}`;
    if (!this.requirements.has(key)) {
        this.requirements.set(key, {
            id: key,
            label: variableName,
            type: "field-suggest",
            source: "collected",
        });
    }
    return "";
}

FieldValueInputSuggest would need to strip the prefix before parsing the field name for vault lookups:

const rawInput = fieldInput.startsWith("FIELD:") ? fieldInput.slice(6) : fieldInput;
const parsed = FieldSuggestionParser.parse(rawInput);

Two changes, no dual-key hacks, no collision risk. I patched main.js locally with this approach and confirmed it resolves the issue.

Related: #1180 / #1175 / #1181 - Same class of bug (one-page key mismatch) for VALUE dropdowns.

Separate issue (not filing here): {{FIELD:People}} outputting [[Name]] into YAML frontmatter without quotes causes YAML to parse it as a nested array. Workaround is quoting in the template: People: "{{FIELD:People}}". The enableTemplatePropertyTypes feature doesn't catch this because isStructuredYamlValue() excludes strings. Can file separately if desired.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions