1 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 * function used for index manipulation pages
8 * Ensures indexes names are valid according to their type and, for a primary
9 * key, lock index name to 'PRIMARY'
11 * @return boolean false if there is no index form, true else
13 function checkIndexName()
15 if (typeof(document.forms['index_frm']) == 'undefined') {
19 // Gets the elements pointers
20 var the_idx_name = document.forms['index_frm'].elements['index'];
21 var the_idx_type = document.forms['index_frm'].elements['index_type'];
23 // Index is a primary key
24 if (the_idx_type.options[0].value == 'PRIMARY' && the_idx_type.options[0].selected) {
25 document.forms['index_frm'].elements['index'].value = 'PRIMARY';
26 if (typeof(the_idx_name.disabled) != 'undefined') {
27 document.forms['index_frm'].elements['index'].disabled = true;
33 if (the_idx_name.value == 'PRIMARY') {
34 document.forms['index_frm'].elements['index'].value = '';
36 if (typeof(the_idx_name.disabled) != 'undefined') {
37 document.forms['index_frm'].elements['index'].disabled = false;
42 } // end of the 'checkIndexName()' function
45 onload = checkIndexName;