#414 [Hugo/Emily] pulled out some common logic in the javascript, and changed the data attribute for selects