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

Skip to content

How to properly handle numeric fields within ListElement in Vueform? #424

@adamberecz

Description

@adamberecz

Discussed in #414

Originally posted by AnnaMuza March 13, 2025
I've been struggling with a specific issue in my Vueform implementation that I hope someone can help clarify.

I'm trying to work with a structure where I have a ListElement containing objects, and within those objects, I need certain fields to be treated as numbers rather than strings. Specifically, I have an id field that I need to be a numeric type.

Here's a simplified version of my current implementation:

<Vueform v-model="formModel"
  :schema="{
    items: {
      type: 'list',
      element: {
        type: 'object',
        schema: {
          id: {
            type: 'text',
            inputType: 'number',
            rules: 'numeric',
            default: -1,
            autocomplete: 'off',
            label: 'ID',
          },
          // Other fields...
        }
      }
    }
  }"/>

The problem is that even with inputType: 'number' and rules: 'numeric', forceNumbers=true, the id value is still being treated as a string in the model. I'd appreciate any guidance or examples of how others have solved this issue.

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions