Merge pull request #1326 from knnniggett/fixGroupSaveBtn

disable save button when nothing slected. fixes #1322
This commit is contained in:
Isaac Connor 2016-03-09 11:43:13 -05:00
commit d51d95ce1e
2 changed files with 10 additions and 2 deletions

View File

@ -67,7 +67,7 @@ xhtmlHeaders( __FILE__, translate('Group')." - ".$newGroup['Name'] );
if ( visibleMonitor( $monitor['Id'] ) )
{
?>
<option value="<?php echo $monitor['Id'] ?>"<?php if ( array_key_exists( $monitor['Id'], $monitorIds ) ) { ?> selected="selected"<?php } ?>><?php echo validHtmlStr($monitor['Name']) ?></option>
<option value="<?php echo $monitor['Id'] ?>"<?php if ( array_key_exists( $monitor['Id'], $monitorIds ) ) { ?> selected="selected"<?php } ?> onclick="configureButtons( this );"><?php echo validHtmlStr($monitor['Name']) ?></option>
<?php
}
}
@ -78,7 +78,7 @@ xhtmlHeaders( __FILE__, translate('Group')." - ".$newGroup['Name'] );
</tbody>
</table>
<div id="contentButtons">
<input type="submit" value="<?php echo translate('Save') ?>"<?php if ( !canEdit( 'Groups' ) ) { ?> disabled="disabled"<?php } ?>/>
<input type="submit" name="saveBtn" value="<?php echo translate('Save') ?>" disabled="disabled" />
<input type="button" value="<?php echo translate('Cancel') ?>" onclick="closeWindow()"/>
</div>
</form>

View File

@ -8,4 +8,12 @@ if ( refreshParent )
opener.location.reload(true);
}
function configureButtons( element ) {
if ( canEditGroups ) {
var form = element.form;
form.saveBtn.disabled = (element.value == 0);
}
}
window.focus();