View Full Version : SOLVED: Field vtype validation ignored by paste operation

24 Sep 2010, 2:00 AM
I have some fields in a form that have a validation rule imposed by a vtype that doesn't allow certain characters. Everything works fine when the user types directly into those fields.
However the validation can be ignored if the user pastes (incorrect) text into the field.

I think what is happening is that the mask is well defined but not the regular expression that validates the field.

The definition goes like this:

Ext.form.VTypes['nameVal'] = /[A-Za-z0-9\- ()\[\].]/;
Ext.form.VTypes['nameMask'] = /[A-Za-z0-9\- ()\[\].]/;
Ext.form.VTypes['nameText'] = 'Invalid name.';
Ext.form.VTypes['name'] = function(v){
return Ext.form.VTypes['nameVal'].test(v);

Ok, solved it, the regular expression should be like this:

/^[A-Za-z0-9\- @()\[\]]+$/