
Originally Posted by
Logic Ali
I omitted to add the i flag to the expression, but could you show the full code that doesn't work?
Ok (my browser is IE 8):
Code:
<form action = '#' method = 'post' onsubmit = "return checkForm( this )">
<input name='data'>
<input type='submit'>
</form>
<script type='text/javascript'>
function checkForm( theForm )
{
var result = /^[a-zA-Z0-9\.;,:' ]{1,100}$/g( theForm.data.value );
if( result )
{
alert('One or more illegal characters were found, the first being character ' + ( result.index + 1 ) + ' "' + result +'".\n\nPlease edit your input.');
}
return !result;
}
</script>
Bookmarks