First commit of wedding-rsvp-rs
This commit includes a fully functional template and Rust backend. The website is able to send e-mails, displays strings in multiple languages, include attachments, and has basic protection again spam (IP based).
This commit is contained in:
61
templates/js/main.js
Executable file
61
templates/js/main.js
Executable file
@@ -0,0 +1,61 @@
|
||||
|
||||
(function ($) {
|
||||
"use strict";
|
||||
|
||||
|
||||
/*==================================================================
|
||||
[ Validate ]*/
|
||||
var name = $('.validate-input input[name="name"]');
|
||||
var email = $('.validate-input input[name="email"]');
|
||||
var guests = $('.validate-input input[name="guests"]');
|
||||
|
||||
|
||||
$('.validate-form').on('submit',function(){
|
||||
var check = true;
|
||||
|
||||
if($(name).val().trim() == ''){
|
||||
showValidate(name);
|
||||
check=false;
|
||||
}
|
||||
|
||||
if($(guests)["0"].checked){
|
||||
showValidate(guests);
|
||||
check=false;
|
||||
}
|
||||
|
||||
|
||||
if($(email).val().trim().match(/^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{1,5}|[0-9]{1,3})(\]?)$/) == null) {
|
||||
showValidate(email);
|
||||
check=false;
|
||||
}
|
||||
|
||||
return check;
|
||||
});
|
||||
|
||||
$('.validate-form .input1').each(function(){
|
||||
$(this).focus(function(){
|
||||
hideValidate(this);
|
||||
});
|
||||
});
|
||||
|
||||
$('.select-box__current').each(function(){
|
||||
$(this).focus(function(){
|
||||
hideValidate($('.select-box__input'));
|
||||
});
|
||||
});
|
||||
|
||||
function showValidate(input) {
|
||||
var thisAlert = $(input).parent();
|
||||
|
||||
$(thisAlert).addClass('alert-validate');
|
||||
}
|
||||
|
||||
function hideValidate(input) {
|
||||
var thisAlert = $(input).parent();
|
||||
|
||||
$(thisAlert).removeClass('alert-validate');
|
||||
}
|
||||
|
||||
|
||||
|
||||
})(jQuery);
|
Reference in New Issue
Block a user