forked from BlogEngine/BlogEngine.NET
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.js
More file actions
59 lines (46 loc) · 2.26 KB
/
contact.js
File metadata and controls
59 lines (46 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
function beginSendMessage() {
if (BlogEngine.$('<%=txtAttachment.ClientID %>') && BlogEngine.$('<%=txtAttachment.ClientID %>').value.length > 0)
return true;
if (!Page_ClientValidate('contact'))
return false;
var recaptchaResponseField = document.getElementById('recaptcha_response_field');
var recaptchaResponse = recaptchaResponseField ? recaptchaResponseField.value : "";
var recaptchaChallengeField = document.getElementById('recaptcha_challenge_field');
var recaptchaChallenge = recaptchaChallengeField ? recaptchaChallengeField.value : "";
var name = BlogEngine.$('<%=txtName.ClientID %>').value;
var email = BlogEngine.$('<%=txtEmail.ClientID %>').value;
var subject = BlogEngine.$('<%=txtSubject.ClientID %>').value;
var message = BlogEngine.$('<%=txtMessage.ClientID %>').value;
var sep = '-||-';
var arg = name + sep + email + sep + subject + sep + message + sep + recaptchaResponse + sep + recaptchaChallenge;
WebForm_DoCallback('__Page', arg, endSendMessage, 'contact', onSendError, false)
BlogEngine.$('<%=btnSend.ClientID %>').disabled = true;
return false;
}
function endSendMessage(arg, context) {
if (arg == "RecaptchaIncorrect") {
displayIncorrectCaptchaMessage();
BlogEngine.$('<%=btnSend.ClientID %>').disabled = false;
if (document.getElementById('recaptcha_response_field')) {
Recaptcha.reload();
}
}
else {
if (document.getElementById("spnCaptchaIncorrect")) document.getElementById("spnCaptchaIncorrect").style.display = "none";
BlogEngine.$('<%=btnSend.ClientID %>').disabled = false;
var form = BlogEngine.$('<%=divForm.ClientID %>')
var thanks = BlogEngine.$('thanks');
form.style.display = 'none';
thanks.innerHTML = arg;
}
}
function displayIncorrectCaptchaMessage() {
if (document.getElementById("spnCaptchaIncorrect")) document.getElementById("spnCaptchaIncorrect").style.display = "";
}
function onSendError(err, context) {
if (document.getElementById('recaptcha_response_field')) {
Recaptcha.reload();
}
BlogEngine.$('<%=btnSend.ClientID %>').disabled = false;
alert("Sorry, but the following occurred while attemping to send your message: " + err);
}