Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Using ?? instead of or causes form tag parser weirdness #3835

@jasonvarga

Description

@jasonvarga

Bug Description

If you use ?? instead of or inside a form:create tag, the errors are incorrect.

It might not have anything to do with the form:create tag at all, but that's just where we noticed it.

Ref #3669

How to Reproduce

  1. Create a form named contact
  2. Add a required field to the blueprint, just so there's an easy way to cause a validation error.
  3. Use this template to output the form:
    {{ form:create in="{foo ?? 'contact'}" }}
      {{ errors | dump }}
      {{ errors | ul }}
      <button>submit</button>
    {{ /form:create }}
    
  4. See that errors is a ViewErrorBag, and that it's not output as a list.
  5. Change ?? to or
  6. See that errors is an array, and they're output correctly.

Environment

Statamic version: 3.1.22

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions