Basic Enterprise Application Realm

Basic Enterprise Application Realm Documentation

  • 1 PHP Reference
    • 1.1 Introduction
    • 1.2 shared_lib.php
    • 1.3 ac_tables.php
    • 1.4 ac_email.php
  • 2 Javascript Reference
    • 2.1 Introduction
    • 2.2 ac_ajax
    • 2.3 ac_event
    • 2.4 ac_filter
    • 2.5 ac_menu
    • 2.6 ac_panel
    • 2.7 ac_select
    • 2.8 ac_toc
  • 3 Forms
    • 3.1 Introduction
    • 3.2 How It Works
    • 3.3 AJAX
    • 3.4 form_processor_v2
    • 3.5 form_processor

2.4 ac_filter

March 10th, 2025

Provides a mechanism for simplifying user input by restricting which characters can be input to a text field according to black or white lists. Auto case correcting to upper or lower case can also be applied.

Current version: 2
Dependencies: none

2.4.1 Public Properties

None.

2.4.2 Public Methods

Version Arguments Purpose
createFilter 2 ID (string), character list (string), black/white list (enumeration)[, case forcing (enumeration)] Registers an HTML <input> element for character input filtering. The characters supplied in the character list string can be used as a white or black list with other key presses being ignored. The black/white list supports the following values: b = black list the characters in the character list; w = white list the characters in the character list. Finally, case can be enforced using the case forwarding argument which supports the following values: U = force lower case input to upper case; l = (lower case L) force upper case input to lower case.

2.4.3 HTML attributes

None.

2.4.4 Usage example

Force input to be numerical

Javascript

ac_filter.createFilter('age','0123456789','w');

HTML

<input type="text" name="age" id="age" maxlength="3">

Force input to be alphabetical and upper case

Javascript

ac_filter.createFilter('name',' qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM','w','U');

HTML

<input type="text" name="name" id="name" maxlength="64">

Block unsupported characters

Javascript

ac_filter.createFilter('profile','"$%/=','b');

HTML

<input type="text" name="profile" id="profile" maxlength="256">

previous: ac_event next: ac_menu