Fix use of empty which isn't supported in old php. Remove the code entirely as I think it was just cutnpasted from somewhere else. We don't care if it is a new server or not in the validate code.

Fixes #2540
This commit is contained in:
Isaac Connor 2019-02-22 11:22:01 -05:00
parent 077c643da0
commit 9a2dd06e1d
2 changed files with 6 additions and 6 deletions

View File

@ -1,11 +1,11 @@
function validateForm( form, newServer ) { function validateForm(form) {
var errors = new Array(); var errors = new Array();
if ( !form.elements['newServer[Name]'].value ) { if ( !form.elements['newServer[Name]'].value ) {
errors[errors.length] = "You must supply a name"; errors[errors.length] = 'You must supply a name';
} }
if ( errors.length ) { if ( errors.length ) {
alert( errors.join( "\n" ) ); alert(errors.join("\n"));
return( false ); return false;
} }
return( true ); return true;
} }

View File

@ -39,7 +39,7 @@ xhtmlHeaders(__FILE__, translate('Server').' - '.$Server->Name());
<h2><?php echo translate('Server').' - '.$Server->Name() ?></h2> <h2><?php echo translate('Server').' - '.$Server->Name() ?></h2>
</div> </div>
<div id="content"> <div id="content">
<form name="contentForm" method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>" onsubmit="return validateForm(this, <?php echo empty($Server->Name())?'true':'false' ?>)"> <form name="contentForm" method="post" action="?" onsubmit="return validateForm(this)">
<input type="hidden" name="view" value="<?php echo $view ?>"/> <input type="hidden" name="view" value="<?php echo $view ?>"/>
<input type="hidden" name="object" value="server"/> <input type="hidden" name="object" value="server"/>
<input type="hidden" name="id" value="<?php echo validHtmlStr($_REQUEST['id']) ?>"/> <input type="hidden" name="id" value="<?php echo validHtmlStr($_REQUEST['id']) ?>"/>