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

41 lines
753 B
JavaScript

Hedera.Contact = new Class({
Extends: Hedera.Form
,activate: function() {
var self = this;
this.$.contactForm.onsubmit = function() {
self._onSubmit(); return false;
};
this.refreshCaptcha();
}
,refreshCaptcha: function() {
params = {
srv: 'rest:misc/captcha',
stamp: new Date().getTime()
};
this.$.captchaImg.src = '?'+ Vn.Url.makeUri(params);
}
,_onSubmit: function() {
this.conn.sendForm(this.$.contactForm,
this._onResponse.bind(this));
}
,_onResponse: function(json) {
var form = this.$.contactForm;
if (json) {
form.reset();
Htk.Toast.showMessage(_('DataSentSuccess'));
} else
Htk.Toast.showError(_('ErrorSendingData'));
form['captcha'].value = '';
this.refreshCaptcha();
}
});