Weird, line one works fine but line 3 give me TypeError: dojo.byId(...).attr is not a function
. There is hidden fields that hold all student pair that as <input type="hidden" id="_hidden_studentname_{somestudentid}" value="aStudentName">
, here {somestudentid} only indicate it as student id variable. The purpose of this is try to get a student name by student id.
dojo.connect(dijit.byId('_studentId_id'), 'onChange', function (val) {
var studentId=dijit.byId("_studentId_id").attr("value"); // line 1
var id="_hidden_studentname_"+studentId;
var studentName=dojo.byId(id).attr("value"); // line 3
dojo.byId("_student_text").attr("value", studentName);
});
So dojo doesn't allow variable put in dojo.byId()
? I am pretty sure the <input type="hidden">
with that id does exist....