<<BACK    HOME    CNCPT    TTRL    JSsf.net/projects/validateformjs[ U | s | m | ? ]
   rqd dec eml int len mcr BSS trm sifAll Concepts
   frm txt pwd txa rdo sl1 chk slmAll Object Types

validate_form.js
Concept: Bad Sub-Strings

Defines a set of bad sub-strings that string values may not contain or equal. Summary
asGlobalBadSubStrs,  bsNoBadSubStrs,  asBadSubStrs,  sMsgBadSubStr All Attributes
txt pwd txa rdo sl1 chk slm Interactive Example Code
Higher  [  trm rqd len dec eml int sif mcr BSS  ]  Lower
Lowest priority of all
Precedence


[TOP]   Bad Sub-Strings attribute: asGlobalBadSubStrs        
Value Purpose The array of strings that all non-sMsgTxt string elements consider illegal.

In my experience, the most commonly-needed bad sub-strings are the escape slash ('\') and the single quote ("'"), to protect against database and JavaScript errors.

Value Rules Must be a good array, and each element must be defined, at least one character in length, and unique.
Object Compatibility form
Attribute Compatibility bsGlobalTrimSpaces
When Provided sMsgBadSubStr must be provided and bsNoBadSubStrs may not be provided (see sMsgTxt element exceptions).
When Not Provided No element may have bsNoBadSubStrs associated to it. Any element having either sMsgBadSubStr or asBadSubStrs associated to it, must also associate the other.
[TOP]   Bad Sub-Strings attribute: bsNoBadSubStrs        
Value Purpose Overrides form.asGlobalBadSubStrs for this single element, declaring all strings legal.
Value Rules Must be a string equal to 'true'.

Note for all BooleanStrings: The only legal values for a BooleanString vf-attributes (those whose names start with 'bs*') are strings equal to either 'true' or 'false'. When 'true',the attribute is considered 'associated',and its concept is activated. When 'false',the attribute is not associated (and,in fact,is explicitly undefined at the bottom of the FLStats constructor).

Object Compatibility text,  password,  textarea
Attribute Compatibility sMsgRequired,  sMsgTxtDec,  sMsgTxtEmail,  sMsgTxtInt,  sMsgBadLength,  bsDontTrimSpaces,  bsTrimSpaces,  sMsgTxtZip5,  sMsgTxtZip5p4,  sMsgTxtPhone7,  sMsgTxtPhone10,  sMsgTxtSsn
When Provided form.asGlobalBadSubStrs must exist, and neither asBadSubStrs nor sMsgBadSubStr may be associated to the element (see sMsgTxt element exceptions).
When Not Provided sMsgBadSubStr must be associated to the element (given the 'sMsgTxt' exception).
[TOP]   Bad Sub-Strings attribute: asBadSubStrs        
Value Purpose The array of strings that this element's value considers illegal. When form.asGlobalSubStrs exists, this overrides it.
Value Rules Must be a good array, and each element must be defined, at least one character in length, and unique.
Object Compatibility text,  password,  textarea
Attribute Compatibility sMsgRequired,  sMsgTxtDec,  sMsgTxtEmail,  sMsgTxtInt,  sMsgBadLength,  sMsgBadSubStr,  bsDontTrimSpaces,  bsTrimSpaces,  sMsgTxtZip5,  sMsgTxtZip5p4,  sMsgTxtPhone7,  sMsgTxtPhone10,  sMsgTxtSsn
When Provided If form.asGlobalBadSubStrs exists, this overrides it for this element only. No matter what, sMsgBadSubStr must also be associated, and bsNoBadSubStrs may not be associated (see sMsgTxt element exceptions).
When Not Provided Unless form.asGlobalBadSubStrs is provided, sMsgBadSubStr may not exist.
[TOP]   Bad Sub-Strings attribute: sMsgBadSubStr        
Value Purpose The error message presented to the user when the value contains or is equal to an illegal string.
Value Rules Must be a string at least one character in length.
Object Compatibility text,  password,  textarea
Attribute Compatibility sMsgRequired,  sMsgTxtDec,  sMsgTxtEmail,  sMsgTxtInt,  sMsgBadLength,  asBadSubStrs,  bsDontTrimSpaces,  bsTrimSpaces,  sMsgTxtZip5,  sMsgTxtZip5p4,  sMsgTxtPhone7,  sMsgTxtPhone10,  sMsgTxtSsn
Special Strings
  • ~BSS_FOUND~: Translated to the bad sub-string found in (or equal to) the value.
  • ~BSS_LIST~: Translated to the list of bad sub-strings. Specifically, either...
         "['" + asBadSubStrs.join("', '") + "']"
         "['" + f_orm.asGlobalBadSubStrs.join("', '") + "']"
    ...depending on which is applicable for the element.
When Provided Either form.asGlobalBadSubStrs or asBadSubStr must be provided, and bsNoBadSubStrs may not be provided (see sMsgTxt element exceptions).
When Not Provided asBadSubStrs may not be provided.


TOP       Exceptions: sMsgTxt* elements and Bad Sub-String attributes

[sMsgTxt* attributes:   sMsgTxtDec, sMsgTxtEml (txt and pwd interactive examples), sMsgTxtInt, SIFmt-attributes]

When form.asGlobalBadSubStrs is provided:
When an sMsgTxt attribute is... ...here are the rules for the below attributes for... ...text / password elements... ...and textarea elements
...associated to the element... bsNoBadSubStrs Forbidden. It is assumed there are no bad sub-strings unless sMsgBadSubStrs is provided. Not applicable
sMsgBadSubStr Optional, unless asBadSubStrs is also provided, in which case this is required. When provided, then this element does have bad sub-strings.
asBadSubStrs Optional. When provided, then this element overrides form.asGlobalBadSubStrs, to define a set of bad-sub-strings for this element only.
...not associated to the element... bsNoBadSubStrs Either this or sMsgBadSubStr is required
sMsgBadSubStr Either this or bsNoBadSubStrs is required
asBadSubStrs Optional. When provided, this overrides form.asGlobalBadSubStrs for this element only.
When form.asGlobalBadSubStrs is not provided:
When an sMsgTxt attribute is... ...here are the rules for the below attributes for... ...text / password elements... ...and textarea elements
...associated to the element... bsNoBadSubStrs Forbidden Not applicable
sMsgBadSubStr Forbidden, unless asBadSubStrs is also provided, in which case this is required.
asBadSubStrs Optional
...not associated to the element... bsNoBadSubStrs Forbidden
sMsgBadSubStr Forbidden, unless asBadSubStrs is also provided, in which case this is required.
asBadSubStrs Optional










TOP     rqd dec eml int len mcr BSS trm sif
<<BACK  TXT pwd txa rdo sl1 chk slm
Object Type Concept
text Bad Sub-Strings

VF-Config Snippet f_orm.your_string.sMsgBadSubStr = 'The sub-string "~BSS_FOUND~" may not equal or be found in your string.\n\n\nAll bad sub-strings: ~BSS_LIST~';
Example Element <INPUT TYPE="text" NAME="your_string">

Note the differences in behavior when sMsgTxtEmail is also associated to the element.

The form Change the vf-configuration
Give me a string having no bad sub-strings:
sMsgTxtEmail
form.asGlobalBadSubStrs
   
   
      bsNoBadSubStrs
      asBadSubStrs
         
         
      sMsgBadSubStr

Each string array element must be separated by ' | ' (space-pipe-space). Also be careful about escaping characters. The top drop-down item is a positive example.

[[     [ CIBC CRSH ]   DBG     ]]



TOP     rqd dec eml int len mcr BSS trm sif
<<BACK  txt PWD txa rdo sl1 chk slm
Object Type Concept
password Bad Sub-Strings

VF-Config Snippet f_orm.secret_string.sMsgBadSubStr = 'The sub-string "~BSS_FOUND~" may not equal or be found in your *secret* string (shhhhh).\n\n\nAll bad sub-strings: ~BSS_LIST~';
Example Element <INPUT TYPE="password" NAME="secret_string">

Note the differences in behavior when sMsgTxtEmail is also associated to the element.

The form Change the vf-configuration
Give me a secret string (shhhhh) having no bad sub-strings:
sMsgTxtEmail
form.asGlobalBadSubStrs
   
   
      bsNoBadSubStrs
      asBadSubStrs
         
         
      sMsgBadSubStr

Each string array element must be separated by ' | ' (space-pipe-space). Also be careful about escaping characters. The top drop-down item is a positive example.

[[     [ CIBC CRSH ]   DBG     ]]



TOP     rqd dec eml int len mcr BSS trm sif
<<BACK  txt pwd TXA rdo sl1 chk slm
Object Type Concept
textarea Bad Sub-Strings

VF-Config Snippet f_orm.your_paragraph.sMsgBadSubStr = 'The sub-string "~BSS_FOUND~" may not equal, or be found in, your paragraph.\n\n\nAll bad sub-strings: ~BSS_LIST~';
Example Element <TEXTAREA NAME="your_paragraph"></TEXTAREA>

The form Change the vf-configuration
Give me a string having a legal length:
form.asGlobalBadSubStrs
   
   
      bsNoBadSubStrs
      asBadSubStrs
         
         
      sMsgBadSubStr

Each string array element must be separated by ' | ' (space-pipe-space). Also be careful about escaping characters. The top drop-down item is a positive example.

[[     [ CIBC CRSH ]   DBG     ]]















































SourceForge.net Logo

Copyright (C) 2003-2005, Jeff Epstein.   All rights reserved.