-
Notifications
You must be signed in to change notification settings - Fork 15
/
helper.js
35 lines (28 loc) · 810 Bytes
/
helper.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Copyright (c) 2010 Nils Schneider
* Distributed under the MIT/X11 software license, see the accompanying
* file license.txt or http://www.opensource.org/licenses/mit-license.php.
*/
function setFormValue(form, name, value) {
var obj = $(form).children('input[name="' + name + '"]');
obj.val(value);
return obj;
}
function getFormValue(form, name) {
var e = $(form).children('input[name="' + name + '"]');
if (e.get(0).type == "checkbox") {
return e.attr("checked");
}
return e.val()
}
function hideValidation(obj) {
var o = $(obj).next('span').removeClass().text('');
}
function showValidation(obj, correct) {
var o = $(obj).next('span');
if(correct) {
o.removeClass().addClass('valRight').html("✔");
} else {
o.removeClass().addClass('valWrong').html("✘");
}
}