[Modify user] Field selector scripted to modify & revert form elements for email input check

#1
This commit is contained in:
eoghan.conlon 2023-07-30 00:05:29 +01:00
parent 4147e8568b
commit 4a42f46089

View file

@ -12,7 +12,7 @@
<label for="pass">Password</label>
<input type="password" id="pass" name="pass"/> <br/>
<label for="field">Field</label>
<select id="field">
<select onchange="selectField()" id="field">
<option value="" selected="selected">Please select an option</option>
<option value="mail">Email</option>
<option value="sshPublicKey">SSH key</option>
@ -58,6 +58,16 @@
document.getElementById('formStatus').innerHTML = "<span style='background-color: red; color: white'>Please select a field to modify</span>";
}
}
function selectField(){
const field = document.getElementById('field').value;
const value = document.getElementById('value');
if(field === 'mail'){
value.type = 'email';
} else {
value.type = 'text';
}
}
</script>
</body>
<script>