Skip to content

Field type to validate "free" text inputs #68

@AndreFCruz

Description

@AndreFCruz

I'm using the FreeTextFieldType class for an input that takes the following form:

  • <input_name>=<sequence-of-numbers>
  • e.g., arg1=1,0.3,9.8,2

I'm using the free text field as this is the only current suitable option, but I think it would be useful to add an optional parameter to the class constructor with a regex validator string, so we can check whether the input is valid before spinning-up a new model train process.

I think this minor modification to FreeTextFieldType could be useful to more people; and in my use case I'd just implement the input above as: new FreeTextFieldType("", "^((\d+(\.\d*)?,)*(\d+(\.\d*)?))?$") (1st parameter is the default value)

Shall I implement this and send in a PR?

PS: another option would be creating an entirely new FieldType CSVNumericFieldType that would be more specific to my case and would require larger code changes, but would also work.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions