diff --git a/emhttp/plugins/dynamix/include/DefaultPageLayout.php b/emhttp/plugins/dynamix/include/DefaultPageLayout.php
index 3f11c03d2..2a019e8c6 100644
--- a/emhttp/plugins/dynamix/include/DefaultPageLayout.php
+++ b/emhttp/plugins/dynamix/include/DefaultPageLayout.php
@@ -388,7 +388,7 @@ function openChanges(cmd,title,nchan,button=0) {
$('div.spinner.fixed').hide();
swal({title:title,text:"
",html:true,animation:'none',showConfirmButton:button!=0,confirmButtonText:"=_('Close')?>"},function(close){
$('.sweet-alert').hide('fast').removeClass('nchan');
- if ($('#submit-button').length > 0) $('#submit-button').remove();
+ if ($('#submit_button').length > 0) $('#submit_button').remove();
});
$('.sweet-alert').addClass('nchan');
$('pre#swalbody').html(data);
diff --git a/emhttp/plugins/dynamix/scripts/feedback b/emhttp/plugins/dynamix/scripts/feedback
index 5c4274795..ae534c116 100755
--- a/emhttp/plugins/dynamix/scripts/feedback
+++ b/emhttp/plugins/dynamix/scripts/feedback
@@ -204,49 +204,50 @@ function form_submit(url, params, panel, diagnostics) {
}
$(function() {
+ $('button.confirm').text("=_('Cancel')?>");
+ if ($('#submit_button').length == 0) $('button.confirm').before('');
+
$('input[name=mode]').click(function() {
- var panel = $('input[name=mode]:checked').val();
- var showPanel = '#'+panel+'_panel';
- $('.allpanels').not(showPanel).fadeOut('fast');
- var loadfunction = window[panel+'_load'];
+ var tab = $('input[name=mode]:checked').val();
+ var panel = '#'+tab+'_panel';
+ var email = "=_('Contact Email Address')?>";
+ $('.allpanels').not(panel).fadeOut('fast');
+ var loadfunction = window[tab+'_load'];
if (typeof loadfunction !== 'undefined' && $.isFunction(loadfunction)) {
loadfunction();
} else {
- $(showPanel).fadeIn('fast');
+ $(panel).fadeIn('fast');
}
- var required = (panel == 'troubleshoot');
- var email = "=_('Contact Email Address')?>";
- var option = " (=_('optional')?>)";
- $('input#email').prop('placeholder',email+(required?'':option)).prop('required',required);
- $('#submit_button').prop('disabled',validInput($('#'+panel+'_panel textarea')));
+ var required = ['troubleshoot'].includes(tab);
+ var optional = required ? "" : " (=_('optional')?>)";
+ $('input#email').prop('placeholder',email+optional).prop('required',required);
+ $('#submit_button').prop('disabled',validInput($('#'+tab+'_panel textarea')));
});
- $('button.confirm').text("=_('Cancel')?>");
- if ($('#submit_button').length == 0) $('button.confirm').before('');
-
$('textarea').on('input change',function(){
$('#submit_button').prop('disabled',validInput($(this)));
});
$('input#email').on('input change',function(){
- var panel = $('input[name=mode]:checked').val();
- $('#submit_button').prop('disabled',validInput($('#'+panel+'_panel textarea')));
+ var tab = $('input[name=mode]:checked').val();
+ $('#submit_button').prop('disabled',validInput($('#'+tab+'_panel textarea')));
});
$('#submit_button').click(function() {
- switch ($('input[name=mode]:checked').val()) {
- case 'featureRequest':
- form_submit('https://keys.lime-technology.com/feedback/featurerequest',{description:$('#featureRequest').val()}, $('#featureRequest_panel'));
+ var tab = '#'+$('input[name=mode]:checked').val();
+ switch (tab) {
+ case '#featureRequest':
+ form_submit('https://keys.lime-technology.com/feedback/featurerequest',{description:$(tab).val()}, $(tab+'_panel'));
break;
- case 'bugReport':
- form_submit('https://keys.lime-technology.com/feedback/bugreport',{description:$('#bugReport').val()}, $('#bugReport_panel'), 1);
+ case '#bugReport':
+ form_submit('https://keys.lime-technology.com/feedback/bugreport',{description:$(tab).val()}, $(tab+'_panel'), 1);
break;
- case 'troubleshoot':
+ case '#troubleshoot':
// @todo - update this to use a new troubleshoot endpoint
- form_submit('https://keys.lime-technology.com/feedback/bugreport',{description:$('#troubleshoot').val()}, $('#troubleshoot_panel'), 1);
+ form_submit('https://keys.lime-technology.com/feedback/bugreport',{description:$(tab).val()}, $(tab+'_panel'), 1);
break;
- case 'otherComment':
- form_submit('https://keys.lime-technology.com/feedback/comment',{description:$('#otherComment').val()}, $('#otherComment_panel'));
+ case '#otherComment':
+ form_submit('https://keys.lime-technology.com/feedback/comment',{description:$(tab).val()}, $(tab+'_panel'));
break;
}
});