Add patient creation form validation

This commit is contained in:
coolneng 2020-06-18 08:06:39 +02:00
parent 322a464eb7
commit 77e604d385
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 36 additions and 3 deletions

View File

@ -22,12 +22,45 @@ function checkDNI(dni) {
}
}
function validateDNI(){
function validateString(input){
if(input == ""){
return false;
}
return true;
}
function validatePatient(){
var name = document.forms["create_form"]["nombre"];
var last_name = document.forms["create_form"]["apellido"];
var dni = document.forms["create_form"]["documento_identificativo"];
var address = document.forms["create_form"]["direccion"];
var country = document.forms["create_form"]["pais"];
if(!checkDNI(dni.value)){
alert("El DNI/NIE no es correcto");
return false;
}
alert("El DNI/NIE es correcto");
}
if(!validateString(name.value)){
alert("Introduce el nombre");
return false;
}
if(!validateString(last_name.value)){
alert("Introduce el apellido");
return false;
}
if(!validateString(address.value)){
alert("Introduce la dirección");
return false;
}
if(!validateString(country.value)){
alert("Introduce el país");
return false;
}
return true;
}