Changes

Removing Special Characters

787 bytes added, 18:12, 24 April 2009
no edit summary
Include the following code in the HTML Tag box of the [[Custom Fields|custom field]] you wish to restrict:
onchange="javascript:this.value=this.value.replace(/['''''character setSearch Expression''''']/g'''flag''',' '''replacement characterNew String''' ');" where *'''Search Expression''' specifies a string value to find.*'''New String''' specifies the replacement string.*'''flag ''' is a command line switch used to control outcome of the replace operation.
where '''character set''' defines which characters you want to remove, and '''replacement character''' defines what you want the special characters replaced with.
If you want the replacement to happen actively while the user is typing into the field use ''onKeyup'' instead of ''onChange''.
==Options==
For Character set Search Expression you can use* \W= Matches any character that is not a word character from the basic Latin alphabet. Equivalent to [^A-Z a-z 0-9 _]* \w = Matches any alphanumeric character from the basic Latin alphabet, including the underscore. Equivalent to [A-Za-z0-9_]* \'= single quotes* \"= double quotes* \d= Matches a digit character in the basic Latin alphabet. Equivalent to [0-9]* \0 = NULL character* \s = Matches a single white space character* [xyz]= A character set. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen. For example, [abcd] is the same as [a-d]. They match the 'b' in "brisket" and the 'c' in "ache".For Flags following options are available* g = global match * i = ignore case
Smartstaff
137
edits