Skip to content

maybe split up name to to components? #29

@jimmywarting

Description

@jimmywarting

I gave this some thoughts about how i was going to map the contact's name into my two input fields (namely "firstname" and "lastname") cuz what i got back was the full name, so i needed a way to split it.

My first thought where: "did i save this contacts name into just one field?" but when i edited the contact, then it was already split up into components.

I read some documentation about autocompletion at mdn and it says this:

"name"
The field expects the value to be a person's full name. Using "name" rather than breaking the name down into its components is generally preferred because it avoids dealing with the wide diversity of human names and how they are structured; however, you can use the following autocomplete values if you do need to break the name down into its components:
"honorific-prefix"
The prefix or title, such as "Mrs.", "Mr.", "Miss", "Ms.", "Dr.", or "Mlle.".
"given-name"
The given (or "first") name.
"additional-name"
The middle name.
"family-name"
The family (or "last") name.
"honorific-suffix"
The suffix, such as "Jr.", "B.Sc.", "PhD.", "MBASW", or "IV".
"nickname"
A nickname or handle.

i think this maybe could be useful to have that option as well.

navigator.contacts.select(["name"]) // full name (given name + family name)
navigator.contacts.select(["given-name"]) // firstname
navigator.contacts.select(["family-name"]) // lastname
navigator.contacts.select(["given-name", "family-name"]) // first & last name separated

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions