Forum

November 2nd, 2014
A A A
Avatar

Lost password?
Advanced Search

— Forum Scope —




— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

The forums are currently locked and only available for read only access
sp_Feed Topic RSS sp_TopicIcon
4.4.4 - Bug in Date validation
03/03/2013
19:12
Avatar
MorkvonOrk
Belgium
Member
Members
Forum Posts: 7
Member Since:
03/03/2013
sp_UserOfflineSmall Offline

When the editrules for 'date' are set to true an error appears on line 5983:   "Uncaught TypeError: cannot set property '1' of undefined".

Appears that "this" needs a JQuery-reference.

I changed "this" by "$(this)" (4 times in this function) and the function works.

Same error reported in the help-forum :

/blog/?page_id=393/help/jqgrid-4-4-4-javascript-error-this-p-is-undefined-in-line-8663/

Mork

04/03/2013
10:06
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

A simple test case is greatly appreciated.

Regards

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

19/03/2013
23:39
Avatar
MorkvonOrk
Belgium
Member
Members
Forum Posts: 7
Member Since:
03/03/2013
sp_UserOfflineSmall Offline

The error appears in an independent function "daysArray" that returns an array with the number of days per month.

Error occurs in Chrome and Firefox. No other browsers tested.

Best regards.

Mork

23/03/2013
23:31
Avatar
melgish
Florida
New Member
Members
Forum Posts: 1
Member Since:
23/03/2013
sp_UserOfflineSmall Offline

I can confirm the same error occurs in IE 10.

My column definition (a work in progress) looks like this:

{
    name: "Date",
    index: "Date",
    width: 72,
    formatter: 'date',
    formatoptions: {
        srcformat: 'm/d/Y',
        newformat: 'm/d/Y',
        defaultValue:null
    },
    editable: true,
    editrules: { required: true, date: true },
    editoptions: { 
        size: 20, 
        dataInit: function (el) { $(el).datepicker(); }
    }
},

I was able to work-around the bug by changing the function block at line 5980 like so:

daysArray = function(n) {
	var i, a = new Array(n);
	for (i = 1; i <= n; i++) {
		a[i] = 31;
		if (i==4 || i==6 || i==9 || i==11) {a[i] = 30;}
		if (i==2) {a[i] = 29;}
	}
	return a;
};

On a related note, why pass 12 in? The number of months in a year isn't likely to change in our lifetime. Laugh

in which case this function can be:

daysArray = function() {return new Array(0,31,29,31,30,31,30,31,31,30,31,30,31)}
25/03/2013
09:14
Avatar
tony
Sofia, Bulgaria
Moderator
Members

Moderators
Forum Posts: 7721
Member Since:
30/10/2007
sp_UserOfflineSmall Offline

Hello,

Thanks for this. Also you  are right. This was a code from the time where we begin with javaScript Wink.

Fixed

Tony

For professional UI suites for Java Script and PHP visit us at our commercial products site - guriddo.net - by the very same guys that created jqGrid.

Forum Timezone: Europe/Sofia

Most Users Ever Online: 715

Currently Online:
84 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

OlegK: 1255

markw65: 179

kobruleht: 144

phicarre: 132

YamilBracho: 124

Renso: 118

Member Stats:

Guest Posters: 447

Members: 11373

Moderators: 2

Admins: 1

Forum Stats:

Groups: 1

Forums: 8

Topics: 10592

Posts: 31289

Newest Members:

, razia, Prankie, psky, praveen neelam, greg.valainis@pa-tech.com

Moderators: tony: 7721, Rumen[Trirand]: 81

Administrators: admin: 66

Comments are closed.
Privacy Policy   Terms and Conditions   Contact Information