Untitled

mail@pastecode.io avatar
unknown
javascript
2 years ago
1.4 kB
2
Indexable
checkValidity() {
  console.log(this.initParamForm);
  if (this.recordName == "WebServices") {
    //Enable is empty
    if (this.initParamForm.value["webservices.enable"] === "") {
      this.toastr.error(this.translateService.instant("webservicesEnableEmpty"));
      return false;
    }
    else if (
      this.initParamForm.value["webservices.enable"] !== "Y" && this.initParamForm.value["webservices.enable"] !== "N" && this.initParamForm.value["webservices.enable"] !== "y" && this.initParamForm.value["webservices.enable"] !== "n"
    ) {
      console.log(this.initParamForm.value["webservices.enable"]);
      this.toastr.error(this.translateService.instant("webservicesEnableIncorrectValue"));
      return false;
    };
    const PORT = parseInt(this.initParamForm.value["webservices.port"]);

    if (isNaN(PORT)) {
      console.log(this.initParamForm.value["webservices.port"]);
      this.toastr.error(this.translateService.instant("webservicesPortIncorrectValue"));
      return false;
    }
    else if (this.initParamForm.value["webservices.port"] === "") {
      this.toastr.error(this.translateService.instant("webservicesPortEmpty"));
      return false;
    }
    else if ((PORT >= 1 && PORT <= 65535)){
      this.toastr.error(this.translateService.instant("webservicesPortIncorrectValue"));
      return false;
    };
  }
  return true;
}