Skip to content

t.toLowerCase is not a function error when clicking on a button template, but not when on actual note #595

@scottmc42

Description

@scottmc42

Please fill out these Check-boxes

  • I checked for existing similar issues
  • I checked that the plugin is up to date
  • The issue persists with all other plugins and themes disabled

Plugin Version

1.4.2

This Issue Occurs on

  • Windows
  • Linux
  • macOS
  • Android
  • iOS

Debug Info

SYSTEM INFO:
	Obsidian version: v1.8.10
	Installer version: v1.8.10
	Operating system: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:22 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6041 24.3.0
	Login status: logged in
	Language: en
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Base theme: dark
	Community theme: Things v2.1.20
	Snippets enabled: 3
	Restricted mode: off
	Plugins installed: 17
	Plugins enabled: 15
		1: Dataview v0.5.68
		2: Calendar v1.5.10
		3: Templater v2.12.1
		4: Force note view mode v1.2.2
		5: Periodic Notes v0.0.17
		6: Style Settings v1.0.9
		7: Meta Bind v1.4.2
		8: Advanced Tables v0.22.1
		9: Linter v1.29.0
		10: Automatic Table Of Contents v1.7.3
		11: Banners v1.3.3
		12: Tracker v1.17.0
		13: Tasks v7.20.0
		14: QuickAdd v1.17.0
		15: Folder notes v1.8.8

RECOMMENDATIONS:
	Custom theme and snippets: for cosmetic issues, please first try updating your theme and disabling your snippets. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community theme and snippets.
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.

Describe the Issue

I have a note that I use for tracking tickets. In the frontmatter it includes the status which is a string and displayed as a Meta Bind drop down, three date fields (start_date, finish_date, close_date) and a checkbox resolved. There are also four Meta Bind Buttons for setting these fields (Start, Finish, Resolve: Done, and Resolve: Won't Fix).

I used to have all of my Meta Bind configurations as the last part of each ticket and the code worked fine. When I moved the code into the Meta Bind Button Templates (via "Add Template from Clipboard"), the two "Resolve" buttons stopped working and gave the following error in the console log:
ButtonMDRC >> error while running action TypeError: t.toLowerCase is not a function at la()....

Here is the la function:

function la(t) {
  if (t.toLowerCase() === "null") return null;
  if (t === "true") return !0;
  if (t === "false") return !1;
  {
    let e = zy.tryParse(t);
    return e.success ? e.value : t;
  }
}

The only thing different between the two buttons that work (Start, Finish) and the two that don't (Done, Won't Fix) is the buttons that fail are trying to set a checkbox field.

And as originally stated, all four buttons worked when they were coded on to the page. The failure only occurred after adding them as Templates in the settings.

Here is the code for a button that is not working as a Template:

    {
      "label": "Resolve: Done",
      "style": "primary",
      "hidden": true,
      "id": "ticket-done",
      "actions": [
        {
          "type": "updateMetadata",
          "bindTarget": "close_date",
          "evaluate": true,
          "value": "new Date().toLocaleDateString('en-CA');"
        },
        {
          "type": "updateMetadata",
          "bindTarget": "resolved",
          "evaluate": false,
          "value": true
        },
        {
          "type": "updateMetadata",
          "bindTarget": "status",
          "evaluate": false,
          "value": "Done"
        }
      ]
    },

Steps to Reproduce

  1. Use the JSON above to create a Button named ticket-done
  2. Create a note with the following frontmatter:
creation_date: 2025-06-10 12:19
start_date: 2025-06-10
finish_date: 
close_date:
status: In progress
resolved: false
description: Document the Meta Bind button template bug
aliases: 
tags:
  - ticket
  1. Add the following code to the body of the note:
## Status

|             | Details                                                                                                                                                                                                                                                                     | Action                                 |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| Status      | `INPUT[inlineSelect(option('None', 'None'), option('In progress', 'In progress'), option('On hold', 'On hold'), option('Awaiting approval', 'Waiting for approval'), option('Won\'t fix', 'Won\'t fix'), option('Done', 'Done')):status]` |                                        |
| Start Date  | `INPUT[datePicker():start_date]`                                                                                                                                                                                                                                            | Start Button                 |
| Finish Date | `INPUT[datePicker():finish_date]`                                                                                                                                                                                                                                           | Finish Button                |
| Close Date  | `INPUT[datePicker():close_date]`                                                                                                                                                                                                                                            | `BUTTON[ticket-done]` Won't Fix Button |
  1. Open the developer's console and clear out any existing messages.
  2. Click the "Resolve: Done" button

Expected Behavior

The button should perform three actions:

  1. Update the frontmatter status to the string "Done"
  2. Update the frontmatter close_date to today's date, "2025-06-26"
  3. Update the frontmatter resolved checkbox to be checked/true

Instead, nothing is updated and a console error message is generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugUndesired behavior caused by this plugin

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions