/* backfeed.js */
var Backfeed = (function() {
  "use strict";
  //define classes to add/remove
  const errorStatusClass = 'glyphicon-remove';
  const errorGroupClass = 'has-error';
  const successStatusClass = 'glyphicon-ok';
  const successGroupClass = 'has-success';

  //attach change listeners to each input
  var watchInputs = function(inputList) {
    for (let formInput in inputList) {
      var currInput = inputList[formInput];
      _registerListener('keyup', currInput['input'], currInput['status'], currInput['group']);
    }
  };
  
  //Add an event listener to a single form input
  var _registerListener = function(eventName, element, status, group) {
    element = document.getElementById(element);
    status = document.getElementById(status);
    group = document.getElementById(group);
    element.addEventListener(eventName, function invoke(event) {
      _updateStatus(event, status, group);
    }, false);
  };

  //update the classes of the usernameInput field
  var _updateStatus = function(event, statusTag, groupTag) {
    var statusClasses = statusTag.classList;
    var groupClasses = groupTag.classList;
    if (event.target.checkValidity()) {
      //contents are valid
      if (!statusClasses.contains(successStatusClass)) {
        statusClasses.add(successStatusClass);
      }
      if (!groupClasses.contains(successGroupClass)) {
        groupClasses.add(successGroupClass);
      }
      if (statusClasses.contains(errorStatusClass)) {
        statusClasses.remove(errorStatusClass);
      }
      if (groupClasses.contains(errorGroupClass)) {
        groupClasses.remove(errorGroupClass);
      }
    } else {
      //contents are invalid
      if (statusClasses.contains(successStatusClass)) {
        statusClasses.remove(successStatusClass);
      }
      if (groupClasses.contains(successGroupClass)) {
        groupClasses.remove(successGroupClass);
      }
      if (!statusClasses.contains(errorStatusClass)) {
        statusClasses.add(errorStatusClass);
      }
      if (!groupClasses.contains(errorGroupClass)) {
        groupClasses.add(errorGroupClass);
      }
    }
  };
  
  return {
    watch: watchInputs
  }
})();

@@ -262,16 +262,115 @@
 uccess';
+%0A  const formGroupClass = 'form-group';%0A  const formControlFeedbackClass = 'form-control-feedback';
 %0A%0A  //at
@@ -606,36 +606,744 @@
 us'%5D
-, currInput%5B'group'%5D);%0A    %7D
+);%0A    %7D%0A  %7D;%0A%0A  //Traverse upward through the DOM to the nearest form group%0A  var _getParentFormGroup = function(element) %7B%0A    while (! element.parentNode.classList.contains(formGroupClass)) %7B%0A      element = element.parentNode;%0A    %7D%0A    return element.parentNode;%0A  %7D;%0A%0A  //Traverse input siblings to find sibling form-control-feedback%0A  var _getSiblingFormControlFeedback = function(element) %7B%0A    var siblingsInclusive = element.parentNode.children;%0A    var sibling;%0A    for (var i = 0; i %3C siblingsInclusive.length; i ++) %7B%0A      sibling = siblingsInclusive%5Bi%5D;%0A      if (sibling !== element) %7B%0A        if (sibling.classList.contains(formControlFeedbackClass)) %7B%0A          return sibling;%0A        %7D%0A      %7D%0A    %7D%0A    return null;
 %0A  %7D
@@ -1457,23 +1457,16 @@
 , status
-, group
 ) %7B%0A    
@@ -1509,24 +1509,28 @@
 ement);%0A    
+var 
 status = doc
@@ -1530,53 +1530,65 @@
 s = 
-document.getElementById(status
+_getSiblingFormControlFeedback(element
 );%0A    
+var 
 group = 
 docu
@@ -1587,37 +1587,35 @@
 p = 
-document.getElementById(group
+_getParentFormGroup(element
 );%0A 

Update internal logic to find sibling span and parent form-group via the DOM.