#Validator for Words
15 messages · Page 1 of 1 (latest)
What's the criteria you want for your validator?
Then use two inputs.
If your API really expects just one field for both, you can always manipulate the form before submitting.
(but it's quite a strange endpoint on your backend side.)
I have a job for doing, and a the task is that.
Is what?
That you need to present a single control to the user, or that you need to send a single field to the API?
I need validate 2 words in 1 input, but i'm going to talk with the owner for using two inputs.
That's doable, but not so smart.
Better explain that to the client before writing useless code.
For your information only (your really should need two inputs, for ergonomic and other reasons): https://angular.io/api/forms/Validators#pattern.
Not even considering the n possible combinations: multiple names, multiple surnames, compound surnames...
Good luck finding if someone actually entered their name when they type someting like Jean Vincent: is it a composed first name, a composed last name, a first name and a last name, or a last name and a first name? You can't know. That's why everybody uses two inputs when you need to differentiate the first name from the last name
Add some "de", "del", "los", "mac" in the middle.