diff --git a/resources/views/contact.blade.php b/resources/views/contact.blade.php index 40fbd71..06c9042 100644 --- a/resources/views/contact.blade.php +++ b/resources/views/contact.blade.php @@ -70,21 +70,21 @@
- +
- +
- +
@@ -135,9 +135,52 @@ } } + function contactEmail(){ + var email = document.getElementById('contact-email').value; + if(email.length == 0){ + $('#contact-email').focus(); + emailError.innerHTML = "Email field is required !"; + return false; + } + else{ + emailError.innerHTML = ''; + return true; + } + } + + function contactPhone(){ + var phone = document.getElementById('contact-phone').value; + if(phone.length == 0){ + $('#contact-phone').focus(); + phoneError.innerHTML = "Phone number is required !"; + return false; + } + if(!phone.match(/^\d{10}$/)){ + phoneError.innerHTML = "Please provide valid 10 digit number"; + return false; + } + else{ + phoneError.innerHTML = ''; + return true; + } + } + + function contactNationality(){ + var nationality = document.getElementById('contact-nationality').value; + if(nationality.length == 0){ + $('#contact-nationality').focus(); + nationalityError.innerHTML = "Nationality field is required !"; + return false; + } + else{ + nationalityError.innerHTML = ''; + return true; + } + } function validateContact(){ - if(!contactFullname()){ + if(!contactFullname() || !contactEmail() || !contactPhone() || + !contactNationality()){ return false; } else{