I have a form. When I press the Send button, the function checks the information.
If everything is ok, I would like to make a stuffed checkbox table.
The table would have (arrows) rows and (rels + cycles) columns. In each cell, I would like to place the checkbox.
Unfortunately, I tried some posts and I did not succeed. Every help is welcome. Many thanks!
function Enviar() {
var flechas = document.getElementById("flechasid");
var rels = document.getElementById("relsid");
var ciclos = document.getElementById("ciclosid");
if (flechas.value > 0 && flechas.value < 30 && ciclos.value > 0 && ciclos.value < 10 && rels.value > 0 && rels.value < 20) {
alert('Os seus dados foram encaminhados com sucesso!');
} else {
alert('Informações inválidas!');
};
}
<!DOCTYPE html>
<html>
<head>
<meta name="description" content="Aprenda a criar PHIAs">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<script src="app.js"></script>
<form name="Untitled-2">
<fieldset>
<legend>
Número de relações do tipo 3
</legend>
<table cellspacing="3">
<tr>
<td>
<label for="rels">
Relações
</label>
</td>
<td align="left">
<input type="text" name="rels" id="relsid" required="required" placeholder=0>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>
Número de flechas nessas relações
</legend>
<table cellspacing="3">
<tr>
<td>
<label for="flechas">
Flechas
</label>
</td>
<td align="left">
<input type="text" name="flechas" id="flechasid" required="required" placeholder=0>
</td>
</tr>
</table>
</fieldset>
<fieldset>
<legend>
Número de ciclos elementares
</legend>
<table cellspacing="3">
<tr>
<td>
<label for="ciclos">
Ciclos
</label>
</td>
<td align="left">
<input type="text" name="ciclos" id="ciclosid" required="required" placeholder=0>
</td>
</tr>
</table>
</fieldset>
<input type="button" onclick="Enviar();" value="Enviar">
<input type="reset" value="Limpar">
</form>
<div id="test"></div>
</body>
</html>