0
1
Fork 0
hedera-web-mindshore/forms/cms/contact/contact.js

41 lines
753 B
JavaScript
Raw Normal View History

2016-07-22 20:00:27 +00:00
2022-10-04 13:12:16 +00:00
Hedera.Contact = new Class({
2016-09-26 09:28:47 +00:00
Extends: Hedera.Form
2016-07-22 20:00:27 +00:00
2022-10-04 13:12:16 +00:00
,activate: function() {
2016-07-22 20:00:27 +00:00
var self = this;
2022-10-04 13:12:16 +00:00
this.$.contactForm.onsubmit = function() {
self._onSubmit(); return false;
};
2016-07-22 20:00:27 +00:00
2022-10-04 13:12:16 +00:00
this.refreshCaptcha();
2016-07-22 20:00:27 +00:00
}
2022-10-04 13:12:16 +00:00
,refreshCaptcha: function() {
params = {
2022-10-04 13:12:16 +00:00
srv: 'rest:misc/captcha',
stamp: new Date().getTime()
};
2022-10-04 13:12:16 +00:00
this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params);
2016-07-22 20:00:27 +00:00
}
2022-10-04 13:12:16 +00:00
,_onSubmit: function() {
this.conn.sendForm(this.$.contactForm,
this._onResponse.bind(this));
2016-07-22 20:00:27 +00:00
}
2022-10-04 13:12:16 +00:00
,_onResponse: function(json) {
2022-05-28 01:18:06 +00:00
var form = this.$.contactForm;
2016-07-22 20:00:27 +00:00
2022-10-04 13:12:16 +00:00
if (json) {
form.reset();
Htk.Toast.showMessage(_('DataSentSuccess'));
} else
Htk.Toast.showError(_('ErrorSendingData'));
2016-07-22 20:00:27 +00:00
form['captcha'].value = '';
2022-10-04 13:12:16 +00:00
this.refreshCaptcha();
2016-07-22 20:00:27 +00:00
}
});