hedera-web/forms/cms/contact/contact.js

47 lines
775 B
JavaScript
Raw Normal View History

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