         <BS.ControlLabel>Name of new course:</BS.ControlLabel>
         <BS.FormControl autoFocus
           type="text"
-          value={NewCourseStore.get('course_name') or ''}
+          value={NewCourseStore.get('name') or ''}
           onChange={@updateName}
         />
       </BS.FormGroup>

  onSelect: (source_course_id) ->
    prev_selected_id = NewCourseStore.get('source_course_id')
    source_course_id = null if source_course_id is prev_selected_id
    course_name = @state.course_name
    newCourse = find(@state.teachingCourses, id: source_course_id)

    if newCourse
      # is the current name blank or the same as the previous course?
      if isEmpty(course_name) or (
        prev_selected_id and find(@state.teachingCourses, id: prev_selected_id).name is course_name
      )
        course_name = newCourse.name
    else
      course_name = ''

    NewCourseActions.set({course_name, source_course_id})

  updateName: (ev) ->
    NewCourseActions.set({course_name: ev.target.value})

  updateSectionCount: (ev) ->
    NewCourseActions.set({number_of_sections: parseInt(ev.target.value, 10)})

CourseDetails = React.createClass

  getInitialState: ->
    teachingCourses: filter(CourseListingStore.allCourses(), (course) ->
      course.appearance_code is NewCourseStore.get('course_code') and find(course.roles, type: 'teacher')
    )
