You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
128 lines
4.6 KiB
128 lines
4.6 KiB
$(function() {
|
|
$("#nature").select2();
|
|
$('select#nature').on("select2:select", function(e) {
|
|
$('.nature').addClass('nature_selected');
|
|
});
|
|
$('label.nature').on('click', function (e) {
|
|
$('#nature').select2('open');
|
|
});
|
|
|
|
//on input after error
|
|
$('input').on('keypress', function(e){
|
|
$(e.target).closest('.form-label-group').removeClass('has-error').find("span.help-block").text('');
|
|
});
|
|
|
|
//remove validation errors on select for subject
|
|
$('select.s1').on('change', function(e) {
|
|
if ($(e.target).val().length > 0) {
|
|
if ($(e.target).prop("name")) {
|
|
$(".select2-container--default .select2-selection--single").css({
|
|
"border-color": "#ccc"
|
|
})
|
|
$(e.target).closest('.form-label-group').removeClass('has-error').find("span.help-block").text('')
|
|
}
|
|
}
|
|
});
|
|
|
|
|
|
//autofocus the first field
|
|
$("#fname").focus();
|
|
$('#send_msg_btn').on('click', function(){
|
|
var options = {
|
|
"submitWhenValid" : function(){
|
|
var dialog;
|
|
$.ajax({
|
|
url : app.get_vars().baseurl+"send_comment",
|
|
type : "POST",
|
|
data : $("form#contact_information").serialize(),
|
|
beforeSend : function(){
|
|
dialog = bootbox.dialog({
|
|
message: '<p class="text-center"><i class="fa fa-spin fa-spinner"/> '+app.get_vars()._app.notif.loading+'</p>',
|
|
closeButton: false
|
|
});
|
|
},
|
|
success : function(result) {
|
|
dialog.modal("hide");
|
|
app._notify(result.mtype, result.message);
|
|
if(result.mtype == 'success'){
|
|
window.setTimeout(function(){window.location.href = app.get_vars().baseurl},3000);
|
|
}
|
|
}
|
|
});
|
|
},
|
|
"validation" : {
|
|
"form_id": "form#contact_information",
|
|
"displayClass" : "pull-right",
|
|
"rules": {
|
|
"name": {
|
|
"required": true
|
|
},
|
|
"fname": {
|
|
"required": true
|
|
},
|
|
"sender": {
|
|
"required": true,
|
|
"email" : true
|
|
},
|
|
"nature": {
|
|
"required": true
|
|
}
|
|
,"comment": {
|
|
"required": true
|
|
}
|
|
}
|
|
}
|
|
};
|
|
app._form._validateContactForm(options);
|
|
});
|
|
|
|
// From event info box contact button
|
|
$('#send_msg_btn_nous').on('click', function(){
|
|
var options = {
|
|
"submitWhenValid" : function(){
|
|
var dialog;
|
|
$.ajax({
|
|
url : baseurl+"send_comment_nous",
|
|
type : "POST",
|
|
data : $("form#contact_information").serialize(),
|
|
beforeSend : function(){
|
|
dialog = bootbox.dialog({
|
|
message: '<p class="text-center"><i class="fa fa-spin fa-spinner"/> '+app.get_vars()._app.notif.loading+'</p>',
|
|
closeButton: false
|
|
});
|
|
},
|
|
success : function(result) {
|
|
dialog.modal("hide");
|
|
app._notify(result.mtype, result.message);
|
|
if(result.mtype == 'success'){
|
|
window.setTimeout(function(){window.location.href = app.get_vars().baseurl},3000);
|
|
}
|
|
}
|
|
});
|
|
},
|
|
"validation" : {
|
|
"form_id": "form#contact_information",
|
|
"displayClass" : "pull-right",
|
|
"rules": {
|
|
"name": {
|
|
"required": true
|
|
},
|
|
"fname": {
|
|
"required": true
|
|
},
|
|
"sender": {
|
|
"required": true,
|
|
"email" : true
|
|
},
|
|
"nature": {
|
|
"required": true
|
|
}
|
|
,"comment": {
|
|
"required": true
|
|
}
|
|
}
|
|
}
|
|
};
|
|
app._form._validateContactForm(options);
|
|
});
|
|
});
|
|
|