put an onchange on the monitorType causing a form submit so that Source and Storage tabs update. Rename action to save and put it on the submit button

This commit is contained in:
Isaac Connor 2020-09-22 14:33:26 -04:00
parent 0aa0452b7e
commit ed6d5a55a5
3 changed files with 11 additions and 5 deletions

View File

@ -24,7 +24,7 @@ if ( ! canEdit('Monitors') ) {
return;
}
if ( $action == 'monitor' ) {
if ( $action == 'save' ) {
$mid = 0;
if ( !empty($_REQUEST['mid']) ) {
$mid = validInt($_REQUEST['mid']);

View File

@ -137,6 +137,13 @@ function initPage() {
document.querySelectorAll('input[name="newMonitor[WebColour]"]').forEach(function(el) {
el.onchange = window['change_WebColour'].bind(el);
});
document.querySelectorAll('select[name="newMonitor[Type]"]').forEach(function(el) {
el.onchange = function() {
var form = document.getElementById('contentForm');
form.tab.value = 'general';
form.submit();
};
});
$j('.chosen').chosen();

View File

@ -460,9 +460,8 @@ if ( canEdit('Monitors') ) {
<!-- BEGIN ITEM LIST -->
<div class="d-flex flex-row container-fluid pr-0">
<form name="contentForm" id="contentForm" method="post" action="?">
<input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="action" value="monitor"/>
<form name="contentForm" id="contentForm" method="post" action="?view=monitor">
<input type="hidden" name="tab" value="<?php echo $tab?>"/>
<input type="hidden" name="mid" value="<?php echo $monitor->Id()?>"/>
<input type="hidden" name="origMethod" value="<?php echo ( null !== $monitor->Method())?validHtmlStr($monitor->Method()):'' ?>"/>
<div class="tab-content" id="pills-tabContent">
@ -1158,7 +1157,7 @@ echo htmlSelect('newMonitor[ReturnLocation]', $return_options, $monitor->ReturnL
?>
</div><!--tab-content-->
<div id="contentButtons" class="pr-3">
<button type="submit" value="Save"<?php echo canEdit('Monitors') ? '' : ' disabled="disabled"' ?>><?php echo translate('Save') ?></button>
<button type="submit" name="action" value="save"<?php echo canEdit('Monitors') ? '' : ' disabled="disabled"' ?>><?php echo translate('Save') ?></button>
<button type="button" id="cancelBtn"><?php echo translate('Cancel') ?></button>
</div>
</form>