PDA

View Full Version : [FIXED-737][2.2 - 3.1] Ext example Advanced VType validation bug and solution



murrah
15 Jan 2010, 4:06 PM
Hi,

I have 2 problems with this example http://www.extjs.com/deploy/dev/examples/form/adv-vtypes.html.

1. Using Firefox (v3.5.7) it doesnt display the forms and I get the following error:
uncaught exception: [Exception... "" nsresult: "0x805e000b (<unknown>)" location: "JS frame :: http://127.0.0.1:8500/sites/extjs/ext-all.js :: anonymous :: line 11" data: no] in the console. I am not sure if that is just me or not. It displays correctly in IE 8.

2. There is what seems to be a bug in the validation. If you put in an incorrectly formatted date (eg type a letter instead of a date) the validation error message says "{0} is not a valid date - it must be in the format {1}". After much experimenting I realised that the error is that the following line needs to change:

Ext.apply(Ext.form.VTypes, {
daterange : function(val, field) {
var date = field.parseDate(val);

if(!date){
//return; // <-- existing code
return true; // <--- change to this
}

If you do that, and type "xyz" for the date, you get the correct error message eg "xyz is not a valid date - it must be in the format m/d/Y"

Cheers,
Murray

sherpam
16 Mar 2010, 5:34 AM
Thanks! Your solution to your 2nd problem has worked for me.
The error message which used to say "{0} is not a valid date - it must be in the format {1}" now replaces the variables and has the input date and the correct format. :)

benny00
16 Mar 2010, 6:54 AM
Well it looks like the bug is there again! Try entering a wrong value into the datefield!
http://www.extjs.com/deploy/ext-3.2-beta/examples/form/adv-vtypes.html

Jamie Avins
16 Mar 2010, 9:04 AM
The first issue is already fixed in svn, I'm opening a bug for the second.

Jamie Avins
16 Mar 2010, 9:24 AM
[type]: fix
[module]: examples
[id]: #737
[desc]: Fixes #737. Fix incorrect return value in the advanced validation example.

murrah
16 Mar 2010, 11:39 AM
The first issue is already fixed in svn, I'm opening a bug for the second.

Thanks!

mpacheco
31 Aug 2010, 10:45 AM
Hi,

This advance validation shold work on ext 2.2?

Thanks,

Martin.-

murrah
31 Aug 2010, 1:00 PM
Yes, I had the problem on v 2.2 - 3.1

senacle
2 Jan 2012, 12:53 AM
2. There is what seems to be a bug in the validation. If you put in an incorrectly formatted date (eg type a letter instead of a date) the validation error message says "{0} is not a valid date - it must be in the format {1}". After much experimenting I realised that the error is that the following line needs to change:

Ext.apply(Ext.form.VTypes, {
daterange : function(val, field) {
var date = field.parseDate(val);

if(!date){
//return; // <-- existing code
return true; // <--- change to this
}

If you do that, and type "xyz" for the date, you get the correct error message eg "xyz is not a valid date - it must be in the format m/d/Y"

Not fixed in the Extjs3.4 sample.
I tried your solution (return true; ), only the enddate field has the good error message. No error message for the start date field.

senacle
2 Jan 2012, 3:46 AM
Not fixed in the Extjs3.4 sample.
I tried your solution (return true; ), only the enddate field has the good error message. No error message for the start date field.

After checking my code, i saw that my startdate has this property :

validationEvent: false,

Without this property (it means that validationEvent is set to the default "keyup"), all is fine.