FSGpilot / frontend-styleguide-components

!! FSGpilot er afviklet til fordel for FDS gå til https://github.com/detfaellesdesignsystem !!
6 stars 18 forks source link

data-input-regex does not re-evaluate entire string #18

Open Bk2 opened 5 years ago

Bk2 commented 5 years ago

When defining a data-input-regex for a text field. The entire string is only evaluated when the user starts to submit input.

Consider a text input field for entering phone numbers created using the following code:

<input aria-required="true" maxlength="20" class="form-control form-input " type="text" name="plejeforaeldre[0].telefonnummer" value="" id="plejeforaeldre[0].telefonnummer" data-input-regex="^(\+|\d)[0-9]*$">

This only allows for entering the '+' if the field is empty. It is not possible to first write a set of numbers and then later add the '+'