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

45 lines
817 B
JavaScript
Raw Normal View History

2016-07-22 20:00:27 +00:00
Vn.Contact = new Class
({
Extends: Vn.Form
,activate: function ()
{
var self = this;
var form = this.$('contact-form').onsubmit = function ()
{ self.onSubmit (); return false; };
this.refreshCaptcha ();
}
,refreshCaptcha: function ()
{
2016-08-23 13:15:19 +00:00
var url = 'rest.php?method=core/captcha';
2016-07-22 20:00:27 +00:00
this.$('captcha-img').src = url +'&stamp='+ new Date ().getTime ();
}
,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 ();
}
});