5 * Validates the password field in a form
7 * @param object the form
9 * @return boolean whether the field value is valid or not
11 function checkPassword(the_form)
13 // Did the user select 'no password'?
14 if (typeof(the_form.elements['nopass']) != 'undefined' && the_form.elements['nopass'][0].checked) {
16 } else if (typeof(the_form.elements['pred_password']) != 'undefined' && (the_form.elements['pred_password'].value == 'none' || the_form.elements['pred_password'].value == 'keep')) {
21 if (the_form.elements['pma_pw'].value == '') {
22 alert(jsPasswordEmpty);
23 the_form.elements['pma_pw2'].value = '';
24 the_form.elements['pma_pw'].focus();
26 } else if (the_form.elements['pma_pw'].value != the_form.elements['pma_pw2'].value) {
27 alert(jsPasswordNotSame);
28 the_form.elements['pma_pw'].value = '';
29 the_form.elements['pma_pw2'].value = '';
30 the_form.elements['pma_pw'].focus();
35 } // end of the 'checkPassword()' function
39 * Validates the "add a user" form
41 * @return boolean whether the form is validated or not
43 function checkAddUser(the_form)
45 if (the_form.elements['pred_hostname'].value == 'userdefined' && the_form.elements['hostname'].value == '') {
47 the_form.elements['hostname'].focus();
51 if (the_form.elements['pred_username'].value == 'userdefined' && the_form.elements['username'].value == '') {
53 the_form.elements['username'].focus();
57 return checkPassword(the_form);
58 } // end of the 'checkAddUser()' function
62 * Checks/unchecks all checkboxes
64 * @param string the form name
65 * @param atring the name of the array with the checlboxes
66 * @param boolean whether to check or to uncheck the element
68 * @return boolean always true
70 function setCheckboxes(the_form, the_checkboxes, do_check)
72 var elts = document.forms[the_form].elements[the_checkboxes + '[]'];
73 var elts_cnt = (typeof(elts.length) != 'undefined')
78 for (var i = 0; i < elts_cnt; i++) {
79 elts[i].checked = do_check;
82 elts.checked = do_check;
86 } // end of the 'setCheckboxes()' function