Ticket #177 (closed defect: fixed)

Opened 4 years ago

Last modified 4 years ago

Regex validator should accept regex string, not regex object

Reported by: idbr Owned by: mpo
Priority: minor Milestone: 0.4
Component: modules/kauri-forms Version: trunk
Keywords: regex validator Cc:

Description

Regex validator in a kauri form is not working:

+validators: 
{
  required : {},
  regex : { regex: "[1-9][0-9][0-9][0-9]" }
}

It seems the basic regex validator needs a regex object (and not a regex string), which is quite impossible in json as far as I know:

+validators: 
{
  required : {},
  regex : { regex: /[1-9][0-9][0-9][0-9]/ }
}

See attachment for fix

Attachments

patch.txt (1.3 KB) - added by idbr 4 years ago.

Change History

Changed 4 years ago by idbr

comment:1 Changed 4 years ago by mpo

  • Status changed from new to closed
  • Resolution set to fixed

Added automatic string to RegExp? conversion in r1361

Note: See TracTickets for help on using tickets.