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

50 lines
865 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);
Vn.Url.makeUri (params)
}
,onSubmit: function ()
{
var request = new Vn.JsonRequest ();
request.sendForm (this.$('contact-form'),
this.onResponse.bind (this));
}
,onResponse: function (request, 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 ();
}
});