47 lines
786 B
JavaScript
47 lines
786 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:core/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, error)
|
|
{
|
|
var form = this.$.contactForm;
|
|
|
|
if (json)
|
|
{
|
|
form.reset ();
|
|
Htk.Toast.showMessage (_('DataSentSuccess'));
|
|
}
|
|
else
|
|
Htk.Toast.showError (_('ErrorSendingData'));
|
|
|
|
form['captcha'].value = '';
|
|
this.refreshCaptcha ();
|
|
}
|
|
});
|
|
|