Merge #16090 - Fix #16049 - checking if select input exists before retrieving the value, but not checking hostname select input value

Merge #16090
Fixes: #16049

Signed-off-by: William Desportes <williamdes@wdes.fr>
This commit is contained in:
William Desportes 2020-05-02 11:46:10 +02:00
commit 7c24eba29d
No known key found for this signature in database
GPG Key ID: 90A0EF1B8251A889

View File

@ -14,13 +14,13 @@
* @return boolean whether the form is validated or not
*/
function checkAddUser (theForm) {
if (theForm.elements.pred_hostname.value === 'userdefined' && theForm.elements.hostname.value === '') {
if (theForm.elements.hostname.value === '') {
alert(Messages.strHostEmpty);
theForm.elements.hostname.focus();
return false;
}
if (theForm.elements.pred_username.value === 'userdefined' && theForm.elements.username.value === '') {
if ((theForm.elements.pred_username && theForm.elements.pred_username.value === 'userdefined') && theForm.elements.username.value === '') {
alert(Messages.strUserEmpty);
theForm.elements.username.focus();
return false;