PDA

View Full Version : Form field marked with an error too soon



sfwalter
13 Apr 2007, 5:47 AM
Hi,

I have standard html form that I am applying Ext fields to. I have two fields and mark them both as "required". When I tab off the first field you see the indicator that the field failed validation (which is correct). However focus is on the second field and it is marked as invalid even though I am still on that second field.

Here is the Ext snippet that I used:

var v1 = new Ext.form.TextField({allowBlank:false});
v1.applyTo('combo-local');
var v2 = new Ext.form.TextField({allowBlank:false});
v2.applyTo('combo-ajax');

I can provide an example if needed

ap
13 Apr 2007, 6:43 AM
Try to set 'validationDelay' to a bigger number. Default is 250 ms

sfwalter
13 Apr 2007, 6:51 AM
I tried setting it to a large number like 5000 (5 seconds) and I can see the delay is working. But when the field receives focus after 5 seconds its getting marked as invalid.

ap
13 Apr 2007, 7:08 AM
It's interesting, I just tried all my from.TextField. Until you start type in a blank text field or lose the focus, the validation is not going to kick in. The default validationEvent is set to "keyup". So your validate blank input should not be fired if you just sit your focus and not type anything regardless of how long. Until you start typing or lose focus.

Maybe you should try to set validationEvent:"keyup" just in case it was set somewhere else. I don't have the problem and if you check the examples none of them have this problem.

sfwalter
13 Apr 2007, 7:39 AM
very weird problem. I fired up the demo pages at extjs.com, http://extjs.com/deploy/ext/examples/form/dynamic.html. I start at the first field in the first form and I leave the the first field, which fails validation. I then tab all the way through the fields until I get to the "Date of birth field" in the third form. When I get to that field it marks the field as failing validation.

Could this be a mac platform issue? I tried it both on firefox and safari with the same problem.

cheers,

scott

tryanDLS
13 Apr 2007, 8:43 AM
It works the same on PC. That birthdate field has allowBlank:false. If you set that true if won't invalidate the empty field.

sfwalter
13 Apr 2007, 9:04 AM
Which is true, the case I'm seeing is when you tab into the birthday field (which has allowBlank:false.) the field is being marked as invalid. The user hasn't pressed anything besides tabbing into the field.

scott.

tryanDLS
13 Apr 2007, 9:39 AM
You're right. I misread that. On PC FF2/IE6/7 it does invalidate on field entry also

jack.slocum
13 Apr 2007, 1:20 PM
The issue is when tabbing, the keyup fires in the destination field which triggers a validation.

This is fixed in SVN. Thanks.