Add updateSelects to forms

So that in forms you don't have to find the equality for each option. Instead,
just set the select value and, afterRender, call updateSelects, the options that
matches the value will become selected.
This commit is contained in:
Scott Erickson 2016-02-25 15:14:48 -08:00
parent 10e03c87c1
commit 946436083c

View file

@ -93,3 +93,9 @@ module.exports.clearFormAlerts = (el) ->
$('.alert.alert-warning', el).remove()
el.find('.help-block.error-help-block').remove()
el.find('.help-block.warning-help-block').remove()
module.exports.updateSelects = (el) ->
el.find('select').each (i, select) ->
value = $(select).attr('value')
$(select).val(value)