blob: c79432563199c97b0c58550f3f84323c24f268d9 [file] [log] [blame]
Rushabh Mehta3966f1d2012-02-23 12:35:32 +05301// ERPNext - web based ERP (http://erpnext.com)
2// Copyright (C) 2012 Web Notes Technologies Pvt Ltd
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
Rushabh Mehta949496c2012-01-25 18:48:46 +053017pscript.onload_contact = function(wrapper) {
18 $('#content-contact-us .btn.primary').click(function() {
19 var me = this;
20 var args = {};
21 args.name = $('#content-contact-us [name="contact-name"]').val();
22 args.email = $('#content-contact-us [name="contact-email"]').val();
23 args.message = $('#content-contact-us [name="contact-message"]').val();
24
25 if(!validate_email(args.email)) {
26 msgprint('Please enter a valid email id');
27 return;
28 }
29
30 if(args.name && args.email && args.message) {
31 $(this).set_working();
32 $c_page('website', 'contact', 'send', args, function(r) {
33 $('#content-contact-us [name*="contact"]').val('');
34 $(me).done_working();
35 });
36 } else {
37 msgprint("Please enter info in all the fields.")
38 }
39 });
40
41 $('#content-contact-us :input').keyup(function(ev) {
42 if(ev.which == 13) {
43 $('#content-contact-us .btn.primary').click();
44 }
45 });
46}