Skip to content

Commit

Permalink
Merge pull request #7 from u-sri2002/submission-success
Browse files Browse the repository at this point in the history
Submission success
  • Loading branch information
Pathum Madhusanka authored Jun 17, 2024
2 parents 7e0f708 + 351ff1f commit a783abe
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 58 deletions.
29 changes: 9 additions & 20 deletions js/contact-us.js
Original file line number Diff line number Diff line change
@@ -1,49 +1,38 @@
const name = document.getElementById('name');
const email = document.getElementById('email');
const form = document.getElementById('form');

const name_error = document.getElementById('name_error');

const email_error = document.getElementById('email_error');



form.addEventListener('submit',(e)=>
{


{
//email regx
var email_check = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;



if(name.value === '' || name.value == null)

{
{// prevent default submission
e.preventDefault();
name_error.innerHTML = "Name is required";
name_error.innerHTML = "Name is required"; // send error for name
}


else
{
name_error.innerHTML = "";
}



if(!email.value.match(email_check))
{
e.preventDefault();
email_error.innerHTML = "Valid Email is required";
email_error.innerHTML = "Valid Email is required"; // send error for email

}


else
{
email_error.innerHTML = "";
email_error.innerHTML = "";
}
// when submission is a success
alert("Submission is Success");


})
});

36 changes: 36 additions & 0 deletions js/doc-register.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,17 @@ const mobile = document.getElementById("mobile");
const experience = document.getElementById("experience");
const password = document.getElementById("password");
const residence = document.getElementById("residence");
const specials = document.getElementById("specialty")
const uploadFile = document.getElementById("uploadFile")

var isValidName = false;
var isValidEmail = false;
var isValidMobile = false;
var isValidExp = false;
var isValidPlace = false;
var isValidPassword = false;
var isValidSpecial = false;
var isFilesUploaded = false;

// function to identify the errors
function sendErrorFor(input, message){
Expand Down Expand Up @@ -49,6 +58,7 @@ function validateMobile(){
}
else{
sendSuccessFor(mobile);
isValidMobile = true;
}
}

Expand Down Expand Up @@ -78,6 +88,7 @@ function validatePassword() {
sendErrorFor(password, "Password must contain at least one special character");
} else {
sendSuccessFor(password);
isValidPassword = true;
}
}

Expand All @@ -99,6 +110,7 @@ function formInputsValidation(){
else{
//send success
sendSuccessFor(userName);
isValidName = true;
}


Expand All @@ -112,6 +124,7 @@ function formInputsValidation(){
}
else{
sendSuccessFor(email);
isValidEmail = true;
}
}

Expand All @@ -133,6 +146,7 @@ function formInputsValidation(){
}
else{
sendSuccessFor(experience);
isValidExp = true;
}
}

Expand All @@ -143,12 +157,34 @@ function formInputsValidation(){
}
else{
sendSuccessFor(residence);
isValidPlace = true;
}

// call function for password validation
validatePassword();

if( specials.value === 'all'){
sendErrorFor(specials, "Please fill your specialization");
}
else{
sendSuccessFor(specials);
isValidSpecial = true;
}

//check liscense uploaded
uploadFile.setAttribute('required', '');
if( uploadFile.files.length <= 0){
sendErrorFor(uploadFile, "Please upload your liscence");
}
else{
sendSuccessFor(uploadFile);
isFilesUploaded = true;
}

// send alert to formpage when submission is success
if (isValidName && isValidEmail && isValidMobile && isValidExp && isValidPlace && isValidPassword && isFilesUploaded && isValidSpecial) {
alert("Submission success..!");
}
}


Expand Down
12 changes: 12 additions & 0 deletions js/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ const userName = document.getElementById("name");
const mobile = document.getElementById("mobile");
const password = document.getElementById("password");

var isValidName = false;
var isValidMobile = false;
var isValidPassword = false;

// function for identify the errors
function sendErrorFor(input, message){
Expand Down Expand Up @@ -38,6 +41,7 @@ function validateMobile(){
}
else{
sendSuccessFor(mobile);
isValidMobile = true;
}
}

Expand Down Expand Up @@ -66,6 +70,7 @@ function validatePassword() {
sendErrorFor(password, "Password must contain at least one special character");
} else {
sendSuccessFor(password);
isValidPassword = true;
}
}

Expand All @@ -82,6 +87,7 @@ function formInputsValidation(){
else{
//send success
sendSuccessFor(userName);
isValidName = true;
}


Expand All @@ -91,6 +97,12 @@ function formInputsValidation(){

// call function for password validation
validatePassword();

// send alert to formpage when submission is success
if (isValidName && isValidMobile && isValidPassword) {
alert("Submission success..!");
}

}


Expand Down
12 changes: 12 additions & 0 deletions js/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ function redirectToLogin(event){
window.location.href = './login.html';
}

var isValidName = false;
var isValidEmail = false;
var isValidMobile = false;
var isValidPassword = false;

// function for identify errors
function sendErrorFor(input, message){
Expand Down Expand Up @@ -54,6 +58,7 @@ function validateMobile(){
}
else{
sendSuccessFor(mobile);
isValidMobile = true;
}
}

Expand Down Expand Up @@ -82,6 +87,7 @@ function validatePassword() {
sendErrorFor(password, "Password must contain at least one special character");
} else {
sendSuccessFor(password);
isValidPassword = true;
}
}

Expand All @@ -100,6 +106,7 @@ function formInputsValidation(){
else{
//send success
sendSuccessFor(userName);
isValidName = true;
}


Expand All @@ -113,6 +120,7 @@ function formInputsValidation(){
}
else{
sendSuccessFor(email);
isValidEmail = true;
}
}

Expand All @@ -123,6 +131,10 @@ function formInputsValidation(){
// call function for password validation
validatePassword();

// send alert to formpage when submission is success
if (isValidName && isValidEmail && isValidMobile && isValidPassword) {
alert("Submission success..!");
}

}

Expand Down
85 changes: 47 additions & 38 deletions register-as-doctor.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,47 +114,56 @@ <h3>Create an Account</h3>
<hr>

<!-- Selecting specialty of the Doctor -->
<label for="specialty">Choose your specialty:</label> <br>
<div class="form-fields">
<label for="specialty">Choose your specialty:</label> <br>

<select id="specialty" name="specialty" class="scrollable-dropdown container form-control">
<option value="allergy-immunology">Allergy and Immunology</option>
<option value="anesthesiology">Anesthesiology</option>
<option value="cardiology">Cardiology</option>
<option value="dermatology">Dermatology</option>
<option value="emergency-medicine">Emergency Medicine</option>
<option value="endocrinology">Endocrinology</option>
<option value="family-medicine">Family Medicine</option>
<option value="gastroenterology">Gastroenterology</option>
<option value="geriatrics">Geriatrics</option>
<option value="hematology">Hematology</option>
<option value="infectious-disease">Infectious Disease</option>
<option value="internal-medicine">Internal Medicine</option>
<option value="medical-genetics">Medical Genetics</option>
<option value="nephrology">Nephrology</option>
<option value="neurology">Neurology</option>
<option value="ob-gyn">Obstetrics and Gynecology (OB/GYN)</option>
<option value="oncology">Oncology</option>
<option value="ophthalmology">Ophthalmology</option>
<option value="orthopedic-surgery">Orthopedic Surgery</option>
<option value="ent">Otolaryngology (ENT)</option>
<option value="pediatrics">Pediatrics</option>
<option value="physical-medicine">Physical Medicine and Rehabilitation</option>
<option value="plastic-surgery">Plastic Surgery</option>
<option value="podiatry">Podiatry</option>
<option value="psychiatry">Psychiatry</option>
<option value="pulmonology">Pulmonology</option>
<option value="radiology">Radiology</option>
<option value="rheumatology">Rheumatology</option>
<option value="surgery">Surgery</option>
<option value="urology">Urology</option>
<option value="vascular-surgery">Vascular Surgery</option>
</select> <br>
<select id="specialty" name="specialty" class="scrollable-dropdown container form-control">
<option value="all">-- All specializations</option>
<option value="allergy-immunology">Allergy and Immunology</option>
<option value="anesthesiology">Anesthesiology</option>
<option value="cardiology">Cardiology</option>
<option value="dermatology">Dermatology</option>
<option value="emergency-medicine">Emergency Medicine</option>
<option value="endocrinology">Endocrinology</option>
<option value="family-medicine">Family Medicine</option>
<option value="gastroenterology">Gastroenterology</option>
<option value="geriatrics">Geriatrics</option>
<option value="hematology">Hematology</option>
<option value="infectious-disease">Infectious Disease</option>
<option value="internal-medicine">Internal Medicine</option>
<option value="medical-genetics">Medical Genetics</option>
<option value="nephrology">Nephrology</option>
<option value="neurology">Neurology</option>
<option value="ob-gyn">Obstetrics and Gynecology (OB/GYN)</option>
<option value="oncology">Oncology</option>
<option value="ophthalmology">Ophthalmology</option>
<option value="orthopedic-surgery">Orthopedic Surgery</option>
<option value="ent">Otolaryngology (ENT)</option>
<option value="pediatrics">Pediatrics</option>
<option value="physical-medicine">Physical Medicine and Rehabilitation</option>
<option value="plastic-surgery">Plastic Surgery</option>
<option value="podiatry">Podiatry</option>
<option value="psychiatry">Psychiatry</option>
<option value="pulmonology">Pulmonology</option>
<option value="radiology">Radiology</option>
<option value="rheumatology">Rheumatology</option>
<option value="surgery">Surgery</option>
<option value="urology">Urology</option>
<option value="vascular-surgery">Vascular Surgery</option>
</select>
<i></i>
<small></small>
</div>


<!-- To upload the digree and license Certificates -->
<label for="digree">Upload your license and Certificates</label> <br>
<input type="file" class="form-control" id="uploadFile" >
<small></small>
<i></i>
<div class="form-dields">
<label for="digree">Upload your license and Certificates</label> <br>
<input type="file" class="form-control" id="uploadFile" >
<i></i>
<small></small>
</div>

<br>

<div class="submit">
Expand Down

0 comments on commit a783abe

Please sign in to comment.