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

47 lines
802 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;
2016-08-25 10:47:09 +00:00
this.$('contact-form').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 = {
'srv': 'rest:core/captcha',
'stamp': new Date ().getTime ()
};
this.$('captcha-img').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
{
2016-09-24 14:32:31 +00:00
this.conn.sendForm (this.$('contact-form'),
this._onResponse.bind (this));
2016-07-22 20:00:27 +00:00
}
2016-09-24 14:32:31 +00:00
,_onResponse: function (json, error)
2016-07-22 20:00:27 +00:00
{
var form = this.$('contact-form');
if (json)
{
form.reset ();
Htk.Toast.showMessage (_('DataSentSuccess'));
}
else
Htk.Toast.showError (_('ErrorSendingData'));
form['captcha'].value = '';
this.refreshCaptcha ();
}
});