diff --git a/src/forms/patient_create_form.php b/src/forms/patient_create_form.php index a3b6da1..ea2411b 100644 --- a/src/forms/patient_create_form.php +++ b/src/forms/patient_create_form.php @@ -7,7 +7,7 @@ - + -
+
diff --git a/src/forms/user_create_form.html b/src/forms/user_create_form.html index 92533a6..e3f6210 100644 --- a/src/forms/user_create_form.html +++ b/src/forms/user_create_form.html @@ -5,9 +5,10 @@ + - +
diff --git a/src/validate_user.js b/src/validate_user.js new file mode 100644 index 0000000..0ec3afd --- /dev/null +++ b/src/validate_user.js @@ -0,0 +1,47 @@ +function validateString(input){ + if(input == ""){ + return false; + } + return true; +} + +function validateEmail(input){ + var emailID = input; + atpos = emailID.indexOf("@"); + dotpos = emailID.lastIndexOf("."); + + if (atpos < 1 || ( dotpos - atpos < 2 )) { + return false; + } + return true; +} + + +function validateUser(){ + var name = document.forms["create_form"]["nombre"]; + var user = document.forms["create_form"]["usuario"]; + var password = document.forms["create_form"]["contraseƱa"]; + var email = document.forms["create_form"]["correo"]; + + if(!validateString(name.value)){ + alert("Introduce el nombre"); + return false; + } + + if(!validateString(user.value)){ + alert("Introduce el usuario"); + return false; + } + + if(!validateString(password.value)){ + alert("Introduce la contraseƱa"); + return false; + } + + if(!validateEmail(email.value)){ + alert("El correo proporcionado es incorrecto"); + return false; + } + + return true; +}