diff --git a/assets/js/form-validate.js b/assets/js/form-validate.js index 64d5a60..b41aa69 100644 --- a/assets/js/form-validate.js +++ b/assets/js/form-validate.js @@ -1,42 +1,54 @@ -function valid_datas( f ){ - - if( f.name.value == '' ){ - jQuery('#form_status').html('Your name must not be empty!'); - notice( f.name ); - }else if( f.email.value == '' ){ - jQuery('#form_status').html('Your email must not be empty and correct format!'); - notice( f.email ); - //}else if( f.phone.value == '' ){ - //jQuery('#form_status').html('Your phone must not be empty and correct format!'); - //notice( f.phone ); - }else if( f.subject.value == '' ){ - jQuery('#form_status').html('Your subject must not be empty!'); - notice( f.subject ); - }else if( f.message.value == '' ){ - jQuery('#form_status').html('Your message must not be empty!'); - notice( f.message ); - }else{ - jQuery.ajax({ - url: 'mail.php', - type: 'post', - data: jQuery('form#fruitkha-contact').serialize(), - complete: function(data) { - jQuery('#form_status').html(data.responseText); - jQuery('#fruitkha-contact').find('input,textarea').attr({value:''}); - jQuery('#fruitkha-contact').css({opacity:1}); - jQuery('#fruitkha-contact').remove(); - } - }); - jQuery('#form_status').html('Sending your message...'); - jQuery('#fruitkha-contact').animate({opacity:0.3}); - jQuery('#fruitkha-contact').find('input,textarea,button').css('border','none').attr({'disabled':''}); - } - - return false; +function valid_datas(f) { + if (f.name.value == '') { + jQuery('#form_status').html( + 'Your name must not be empty!' + ); + notice(f.name); + } else if (f.email.value == '') { + jQuery('#form_status').html( + 'Your email must not be empty and correct format!' + ); + notice(f.email); + //}else if( f.phone.value == '' ){ + //jQuery('#form_status').html('Your phone must not be empty and correct format!'); + //notice( f.phone ); + } else if (f.subject.value == '') { + jQuery('#form_status').html( + 'Your subject must not be empty!' + ); + notice(f.subject); + } else if (f.message.value == '') { + jQuery('#form_status').html( + 'Your message must not be empty!' + ); + notice(f.message); + } else { + jQuery.ajax({ + url: 'mail.php', + type: 'post', + data: jQuery('form#dow-contact').serialize(), + complete: function (data) { + jQuery('#form_status').html(data.responseText); + jQuery('#dow-contact').find('input,textarea').attr({ value: '' }); + jQuery('#dow-contact').css({ opacity: 1 }); + jQuery('#dow-contact').remove(); + }, + }); + jQuery('#form_status').html( + 'Sending your message...' + ); + jQuery('#dow-contact').animate({ opacity: 0.3 }); + jQuery('#dow-contact') + .find('input,textarea,button') + .css('border', 'none') + .attr({ disabled: '' }); + } + + return false; } -function notice( f ){ - jQuery('#fruitkha-contact').find('input,textarea').css('border','none'); - f.style.border = '1px solid red'; - f.focus(); -} \ No newline at end of file +function notice(f) { + jQuery('#dow-contact').find('input,textarea').css('border', 'none'); + f.style.border = '1px solid red'; + f.focus(); +} diff --git a/index.html b/index.html index ecc01a9..95b7a76 100644 --- a/index.html +++ b/index.html @@ -242,7 +242,7 @@