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

43 lines
806 B
JavaScript
Raw Normal View History

2022-11-16 01:44:39 +00:00
import './style.scss';
2016-07-22 20:00:27 +00:00
2022-11-16 01:44:39 +00:00
export default new Class({
Extends: Hedera.Form,
Template: require('./ui.xml')
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
}
});