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

47 lines
802 B
JavaScript

Hedera.Contact = new Class
({
Extends: Hedera.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 ();
}
});