fix save button in controlpreset modal

This commit is contained in:
Andrew Bauer 2020-10-02 16:10:32 -05:00
parent 802e439cb5
commit a97e526298
3 changed files with 9 additions and 4 deletions

View File

@ -38,7 +38,7 @@ for ( $i = 1; $i <= $monitor['NumPresets']; $i++ ) {
<input type="hidden" name="action" value="control"/>
<input type="hidden" name="control" value="presetSet"/>
<input type="hidden" name="showControls" value="1"/>
<p><?php echo buildSelect('preset', $presets, 'updateLabel()' ) ?></p>
<p><?php echo buildSelect('preset', $presets, 'updatePresetLabels()' ) ?></p>
<p>
<label for="newLabel"><?php echo translate('NewLabel') ?></label>
<input type="text" name="newLabel" id="newLabel" value=""/>
@ -46,7 +46,7 @@ for ( $i = 1; $i <= $monitor['NumPresets']; $i++ ) {
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary" value="Save"><?php echo translate('Save') ?></button>
<button type="submit" class="btn btn-primary" id="cPresetSubmitModal" value="Save"><?php echo translate('Save') ?></button>
<button type="button" class="btn btn-secondary" data-dismiss="modal"><?php echo translate('Cancel') ?></button>
</div>
</form>

View File

@ -36,6 +36,6 @@ if ( $action == 'control' ) {
$ctrlCommand = buildControlCommand($monitor);
$monitor->sendControlCommand($ctrlCommand);
$view = 'none';
$redirect = $_SERVER['HTTP_REFERER'];
}
?>

View File

@ -816,7 +816,7 @@ function reloadWebSite() {
}
function updatePresetLabels() {
var form = $('contentForm');
var form = $('ctrlPresetForm');
var preset_ddm = form.elements['preset'];
var presetIndex = preset_ddm[preset_ddm.selectedIndex].value;
@ -836,6 +836,11 @@ function getCtrlPresetModal() {
$j("body").append(data.html);
}
updatePresetLabels();
// Manage the Save button
$j('#cPresetSubmitModal').click(function(evt) {
evt.preventDefault();
$j('#ctrlPresetForm').submit();
});
})
.fail(logAjaxFail);
}