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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

python - How to remove the Xframe Options header in django? -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -