lundi 9 novembre 2020

Validation google maps pin location in an html form

I am working on a simple form in a react project that takes some data from the user along with google location pin link. I just want to add validation on a simple input field to check if the link is valid or not. For example,

<input pattern="HERE_IS_THE_PATTERN_I_NEED" name="location_pin" onChange={handleChange}/>

And here is an example of a correct URL: http://maps.google.com/?q=25.37085051,51.53912149 Moreover, I want to extract the values of "q" from the link using regex. How can I achieve this?

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire