javascript call to controller function

edited November 2011 in Modules
What is wrong with this code?
The first select combo change event works fine but does not work in other event.
var StudentsAttendanceController = {

init : function(initObj){
this._super(initObj);
},
add_edit : function(){


fuel.controller.BaseFuelController.prototype.add_edit.call(this);
$('#students_attendance_class_id').change(function(){
alert('done');
});


$('#students_attendance_section_id').change(function(){
alert('not done');
});
}

};
jqx.extendController(StudentsAttendanceController);

Comments

  • edited 12:24AM
    Tough to say. But if one is working and the other isn't, I'd double check the source to make sure the id used in the Javascript matches what is in the HTML.
  • edited November 2011
    The id matches on html and js:
    the html output is

    <td class="value">
    <select name="students_attendance[class_id]" id="students_attendance_class_id">

    </select>
    </td>

    <td class="label"><label for="section_id" id="label_section_id">Section
    <td class="value"><select id="students_attendance_section_id" name="students_attendance[section_id]">
    </td>
  • edited 12:24AM
    Not sure if this would help, but do you need an ending </select>
Sign In or Register to comment.