jqgrid - Can't figure out JavaScript Undefined is not a function error -


the following code throwing "undefined not function" error @ point indicated.

beforesubmit: function(data, formid) {             data.classid = data.classname; // copy classname value classid             data.studentid = data.studentname; // copy studentname value studentid             var studentrows = $studenttable.jqgrid('getrowdata'),                 classrows = $classtable.jqgrid('getrowdata'),                 enrollrows = $enrolltable.jqgrid('getrowdata'),                 idx, dob, age, minage, maxage, stime, etime, st, et;             (idx in studentrows) {                 if (studentrows[idx].studentid === data.studentid) {                     dob = studentrows[idx].dob;                     break;                 }             }             if (typeof dob != "undefined") {                 age = calcage(dob);             }             (idx in classrows) {                 if (classrows[idx].classid === data.classid) {                     minage = parseint(classrows[idx].minage);                     maxage = parseint(classrows[idx].maxage);                     stime = moment(coopstartdate.format('yyyy-mm-dd')+' '+classrows[idx].starttime, 'yyyy-mm-dd h:mm a');                     etime = stime.clone().add(classrows['classminutes'], 'minutes');                     break;                 }             }              if (typeof age != "undefined" && typeof minage != "undefined" && typeof maxage != "undefined") {                 if (age < minage || age > maxage) {                     return [false, "your student "+age+". minimum age class "+minage+", , maximum age " + maxage];                 }             }              if (typeof stime != "undefined" && typeof etime != "undefined") {                 (idx in enrollrows) {                     if (enrollrows[idx].studentid === data.studentid) {                         st = moment(coopstartdate.format('yyyy-mm-dd')+' '+enrollrows[idx].starttime, 'yyyy-mm-dd h:mm a');                         et = st.clone().add(enrollrows[idx].classminutes, 'minutes');                         // error thrown on next line                         if ((stime.isbefore(et) || stime.isequal(et)) && (etime.isafter(st) || etime.isequal(st))) {                             return [false, "this student in class @ time of selected class."];                         }                     }                 }             }             return [false, "something bad happened."];         } 

this code part of jqgrid table, , using momentjs date objects. can create same momentjs objects , copy/paste same 'if' statement js console, , executes fine. further, age/minage/maxage test preceding works perfectly. there wrong particular context, , can't figure out is.

does see wrong?

i think instead of isequal, need issame

http://momentjs.com/docs/#/query/is-same/


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -