javascript - Force street address with Google Places Autocomplete? -


i know can restrict google places api return addressers using option types: ['address']. wondering if possible force user give street address including street number, "drottninggatan 100" , not "drottninggatan"?

if cannot force behaviour, way of validating user has selected "drottninggatan 100" , not "drottninggatan"?

(btw i'm using javascript api , angularjs)

well.. can use javascript match function regex check format of input... following example check if address contains @ least number.

var resultbox = document.getelementbyid("ifvalid");    function textboxchanged(){      var address=document.getelementbyid("address").value;                  if (address.match(/[0-9]/i)==null){          resultbox.style.color="red";          resultbox.innerhtml="not valid";      } else {          resultbox.style.color="green";          resultbox.innerhtml="valid";      }    }
<input type="text" id="address" placeholder="enter address" onkeyup="textboxchanged()">        <p id="ifvalid" style="color: red;">not valid</p>


Comments

Popular posts from this blog

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

Hard vs. Soft Water: What's The Difference?

The Ten Most Livable Cities In The World