Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IP address or hostname type preference value #185

Open
shiyeling opened this issue Nov 30, 2022 · 7 comments
Open

IP address or hostname type preference value #185

shiyeling opened this issue Nov 30, 2022 · 7 comments
Labels
enhancement New feature or request

Comments

@shiyeling
Copy link

Is your feature request related to a problem? Please describe.
In my case, i need to configure a server address, might be an IP address or domain name. Now I'm using just text input, it could work but user does not have proper feedback if they messed up the address format.

Describe the solution you'd like
provide validation and prompt for IP address or domain name input, which programmer could provide as an validation function in preference constructor.

Describe alternatives you've considered
A call back function so that programmer could valide preference and prevent user from saving mal-formatted preference data.

Additional context
NONE

@shiyeling shiyeling added the enhancement New feature or request label Nov 30, 2022
@lacymorrow
Copy link
Collaborator

This is called input masking: https://css-tricks.com/input-masking/

@shiyeling
Copy link
Author

This is called input masking: https://css-tricks.com/input-masking/

Thanks for letting me know. That looks intuitive and nice.

@dewiweb
Copy link

dewiweb commented Feb 22, 2024

Is there any news about this issue? I'm also interested by IPV4(auto-adding dots each three characters) and port input fields, but I don't understand how to implement @lacymorrow suggestion in a non-jquery way:

This is called input masking: https://css-tricks.com/input-masking/

@lacymorrow
Copy link
Collaborator

@dewiweb Did you open the link? The first example is jQuery.

If you have specific questions about issues you are having and want to post a code sample, I'm happy to assist.

@dewiweb
Copy link

dewiweb commented Feb 22, 2024

Finally I use regex to validate ipv4:port and open a info message box if user entries are unvalidated by regex.
@lacymorrow
Thanks for reply but I don't use jQuery !

@pvrobays
Copy link
Collaborator

@dewiweb Good that you found a workaround.
I think what @lacymorrow proposed is just a few ways of how we could implement input masking in electron-preferences. However, it currently isn't.

If you want you can try to implement it and create a PR :)

@lacymorrow
Copy link
Collaborator

@pvrobays I don't think the library is completely set up for this, but I think we could do something fancy with the regular text input field to allow the user to manage the input/mask themselves.

Potentially allow them to receive change events and pass an optional value to the input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants