summaryrefslogtreecommitdiffstats
path: root/extensions/BMO/web/js/form_validate.js
blob: 6c8fa6f075ffbc4a98f0283c4c2e1e2cca12604f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/**
 * Some Form Validation and Interaction
 **/
//Makes sure that there is an '@' in the address with a '.' 
//somewhere after it (and at least one character in between them

function isValidEmail(email) {
    var at_index = email.indexOf("@");
    var last_dot = email.lastIndexOf(".");
    return at_index > 0 && last_dot > (at_index + 1);
}

//Takes a DOM element id and makes sure that it is filled out
function isFilledOut(elem_id)  {
    var str = document.getElementById(elem_id).value;
    return str.length>0 && str!="noneselected";
}

function isChecked(elem_id) {
    return document.getElementById(elem_id).checked;
}