Good morning, I have a doubt in the study. I need to display only a few div of the form, I tried some methods, without success.
I save OK,
I choose 1 of the 3 options in the registry
It introduces me the input I need, and saves.
But in the edition as that I do to appear only the values corresponding to the value of the radius. I can only present them all together
try some things like empty, or maybe I did not know how to use a placement for it
function mostra(valor) {
if (valor == "IF") {
document.getElementById("IF").style.display = "block";
document.getElementById("CAD").style.display = "none";
document.getElementById("DROID").style.display = "none";
} else if (valor == "CAD") {
document.getElementById("IF").style.display = "none";
document.getElementById("CAD").style.display = "block";
document.getElementById("DROID").style.display = "none";
} else if (valor == "DROID") {
document.getElementById("IF").style.display = "none";
document.getElementById("CAD").style.display = "none";
document.getElementById("DROID").style.display = "block";
}
}
function mostra(theId) {
var theArray = new Array('IF', 'CAD', 'DROID');
w = document.getElementById(theId)
if (w.style.display == "block") {
w.style.display = 'none';
} else {
for (i = 0; i < theArray.length; i++) {
if (theArray[i] == theId) {
w.style.display = 'block';
} else {
document.getElementById(theArray[i]).style.display = 'none';
}
}
}
}
#IF,
#CAD,
#DROID {
display: none;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.4.11/d3.min.js"></script><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="modal-body" class="row">
<label><b>Selecione</b></label>
<label class="radio-inline">
<input onclick="mostra('IF')" type="radio" name="tipo" value="IF" > IF </label>
<label class="radio-inline">
<input onclick="mostra('CAD')" type="radio" name="tipo" value="CAD" > CAD </label>
<label class="radio-inline">
<input onclick="mostra('DROID')" type="radio" name="tipo" value="DROID"> DROID </label>
<hr>
</div>
<form method="post" action="#" id="pdvcad">
<div class="tab-content">
<div id="IF">
<div class="col-sm-12">
<div class="row">
<div class="col-md-2"><label>ID</label>
<input type="text" class="form-control" name="idif" id="idif" />
</div>
<div class="col-md-3"><label>Tipo:</label>
<select class="form-control" id="modelo" name="modelo">
<option id="modelo" value="POS">POS</option>
<option id="modelo" value="MP">MP</option>
</select>
</div>
<div class="col-md-3"><label>Pedido:</label>
<input type="text" class="form-control" name="pedido2" id="pedido2" />
</div>
</div>
</div>
</div>
<div id="CAD">
<div class="col-sm-12">
<div class="row">
<div class="col-md-4"><label>Numero Serie:</label>
<input type="text" name="nserie" id="nserie" maxlength="11" data-mask="000000000-00" class="form-control showcase sweet" />
</div>
</div>
<div class="row">
<div class="col-md-4"><label>Versao:</label>
<input type="date" class="form-control" name="versao" id="versao" value="" />
</div>
</div>
</div>
</div>
<div id="DROID">
<div class="col-sm-12">
<div class="col-md-3"><label>Usa Cadastro<label>
<br>
<input id="cad" type="radio" value="NAO" name="cad" class="radio-template">
<label for="cad">SIM</label>
<input id="cad" type="radio" checked="" value="SIM" name="cad" class="radio-template">
<label for="cad">NÃO</label>
</div>
<div class="col-md-5"><label>Licença:</label>
<input type="text" class="form-control" name="lic" id="lic" />
</div>
<div class="col-md-3"><label>Expira:</label>
<input type="text" class="form-control" name="vencto" id="vencto" readonly />
</div>
</div>
</div>
</div>
PS: when identifying the value of the select show are the values that were filled, without needing a select As in Example Home I tried with some explanations but it made things worse.
Thank you for your help