use-mask-input icon indicating copy to clipboard operation
use-mask-input copied to clipboard

url mask placeholder option

Open monecchi opened this issue 1 year ago • 4 comments

How do I change the placeholder for the url mask?

I'm using Next.js 14 with along 'react-hook-form'

The following does not seem to work:

{...registerWithMask('website', 'url', { 'placeholder': 'https://' })}

I want to change the placeholder for the url mask placeholder from http:// to https...

I've gave the code a look here, and it seems to be set to https by default, but my placeholder is http as also the input masked value: http://mywebsite.com

monecchi avatar Sep 09 '24 20:09 monecchi

hey @monecchi how u doing?

well, the url alias treat http and https so you cant set an placehold who trait the mask contract.

in this case its better use an custom mask.

i belive the follow mask will work:

"https:/\/(a|9|.|/|?|=){1,}"

eduardoborges avatar Sep 15 '24 15:09 eduardoborges

@eduardoborges Thanks! I'll give it a try!

monecchi avatar Sep 18 '24 23:09 monecchi

Hey @monecchi, results? haha

eduardoborges avatar Oct 29 '24 13:10 eduardoborges

@eduardoborges Thanks for following up. It worked somehow… Although the regex did the trick, the masked result is only readable (visible) after submitting the form, it has a sort of “glitch” and it does not allow typing the (.) dot also. I’ll keep an eye on that in order to see if I’m applying it the right way.

monecchi avatar Oct 31 '24 03:10 monecchi