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

47 lines
794 B
JavaScript

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