evoWeb / store_finder

Store finder extension for TYPO3
GNU General Public License v2.0
2 stars 9 forks source link

zipcode that does not exist in that country - throws an error. #31

Closed Domtaholic closed 3 years ago

Domtaholic commented 3 years ago

Hi,

übergibt man eine PLZ die nicht im Land liegt, z.B. 91550 für Monaco dann landet man aktuell in diesem Fehler.

image

Das Location Object hat dann für lat und long jeweils die Werte 0 und führt daher zu einem Fehler.

das sollte noch abgefangen werden, auch wenn das theoretisch Anwenderfehler sind.

Grüße

garbast commented 3 years ago

First of, issue language is english!

Second, you are welcome to hand in a PR.

Domtaholic commented 3 years ago

Fixed it on my own - im not gonna debug that whole extension to fix that. For anyone interested, we just ajax the form to see if it fails or not, if so we just mark the zipcode field red.

` initStoreFinderCheck: function(){ let checked = false;

    $("#tx-storefinder form").on('submit', function(event){
      let ref_this = this;

      if(!checked){
            event.preventDefault();

            $.ajax({
              url: $(this).attr("action"),
              data: $(this).serialize(),
              method: 'POST',
              success: function(){    
                checked = true;
                $(ref_this).submit();
              },
              error: function(){
                $(this).find("#zipcode").css("border", "1px solid red");
              }     
            });
      }
    });
}

`