PHP Classes

File: htdocs/js/form_field_toggle_enable.js

Recommend this page to a friend!
  Classes of ask sa sa   PHP LDAP admin   htdocs/js/form_field_toggle_enable.js   Download  
File: htdocs/js/form_field_toggle_enable.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP LDAP admin
Perform operations to administer a LDAP server
Author: By
Last change:
Date: 1 year ago
Size: 1,245 bytes
 

Contents

Class file image Download
/** * This function will provide a enable/disable toggle for a HTML form field */ function form_field_toggle_enable(field,disable,focus,rev) { var i; var result; var element; switch (field.type) { case 'checkbox': if (field.checked) result = rev ? false : true; else result = rev ? true : false; for (i=0;i<disable.length;i++) { element = disable[i]; field.form[element].disabled = result; if (focus && (disable[i] == focus)) field.form[element].focus(); } break; default: alert('field: '+field.type+' disable: '+disable.length+' focus: '+focus); } } /** * Used by the copy form to enable/disable the recursive copy and delete */ function copy_field_toggle(field) { var disable = ['remove','filter']; var clear = 'remove'; form_field_toggle_enable(field,disable,'filter',true); field.form[clear].checked = field.form[clear].checked && field.checked ? true : false; } /** * Used by the export form to enable/disable compression */ function export_field_toggle(field) { var disable = ['compress']; var clear = 'compress'; form_field_toggle_enable(field,disable,'compress',true); field.form[clear].checked = field.form[clear].checked && field.checked ? true : false; }