Changes

Jump to: navigation, search

Removing Special Characters

523 bytes added, 14:22, 24 April 2009
no edit summary
To prevent a user from entering certain special characters in designated form fields.

Write the following code in Javascript box of a Custom field of type Special-Browser Script:
<pre>
var r={'special':/[\W]/g}
function valid(o,w){
o.value = o.value.replace(r[w],'');
}
</pre>

Write the following code in the HTML Tag box of the custom field:
<pre>
onkeyup="valid(this,'special')" onblur="valid(this,'special')"
</pre>

Note: this can be extended to check for double quotes or single quotes or only for integer numbers.
Smartstaff
137
edits

Navigation menu