aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Somerville <matthew-github@dracos.co.uk>2017-06-22 12:14:08 +0100
committerMatthew Somerville <matthew-github@dracos.co.uk>2017-06-30 17:20:46 +0100
commit225dd2398de39ba38006a3ec4e2f854aede55537 (patch)
tree02a93a71115e6a63889a7a82b59ad8d218722482
parentd1db682c5a847b4b1ee76b47344b7f62fd02cd0f (diff)
Fix bug when switching state to duplicate and back
It would match the wrong submit button (because switching to duplicate introduced new submit buttons).
-rw-r--r--web/cobrands/fixmystreet/staff.js8
1 files changed, 2 insertions, 6 deletions
diff --git a/web/cobrands/fixmystreet/staff.js b/web/cobrands/fixmystreet/staff.js
index 3bb51fc0b..febd306ba 100644
--- a/web/cobrands/fixmystreet/staff.js
+++ b/web/cobrands/fixmystreet/staff.js
@@ -226,13 +226,9 @@ $.extend(fixmystreet.set_up, {
// The inspect form submit button can change depending on the selected state
$inspect_form.find("[name=state]").change(function(){
var state = $(this).val();
- var $submit = $inspect_form.find("input[type=submit]");
+ var $submit = $inspect_form.find("input[type=submit][name=save]");
var value = $submit.attr('data-value-'+state);
- if (value !== undefined) {
- $submit.val(value);
- } else {
- $submit.val($submit.data('valueOriginal'));
- }
+ $submit.val(value || $submit.data('valueOriginal'));
// We might also have a response template to preselect for the new state
var $select = $inspect_form.find("select.js-template-name");