Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Tami

Grupo de Checkbox

Recommended Posts

Olá pessoal...

Preciso de uma ajudinha. É o seguinte, tenho 03 checkbox:

 

Escolaridade:

 

1 - Ensino Médio

2 - Ensino Profissional

3 - Ensino Superior

 

Será obrigatório marcar pelo menos uma das opções. Como faço isso?

Segue o código...

 

<table cellpadding='0' cellspacing='0' class='tabLine'><tr>
<td class="titulo_form">
Escolaridade*
</td></tr></table>
<br>

<table cellpadding="0" cellspacing="0"><tr><td class="label_form">Ensino Médio</td>
<td style='width:25px'><INPUT NAME="tmp.edt.solicitacao_nivelmedio" ID="tmp.edt.solicitacao_nivelmedio" VALUE="1" TYPE="Checkbox" ONCLICK="curso1(this.value,this.checked);" /></td></tr></table>

<span id="ensmedio">
</span>

<table cellpadding="0" cellspacing="0"><tr><td class="label_form">Ensino Profissional</td>
<td style='width:25px'><INPUT NAME="tmp.edt.solicitacao_niveltecnico" ID="tmp.edt.solicitacao_niveltecnico" VALUE="2" TYPE="Checkbox" ONCLICK="curso2(this.value,this.checked);" /></td></tr></table>

<span id="enstecnico">
</span>

<table cellpadding="0" cellspacing="0"><tr><td class="label_form">Ensino Superior</td>
<td style='width:25px'><INPUT NAME="tmp.edt.solicitacao_nivelsuperior" ID="tmp.edt.solicitacao_nivelsuperior" VALUE="3" TYPE="Checkbox" ONCLICK="curso3(this.value,this.checked);" /></td></tr></table>

 

Obrigada, Tami

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ve se te ajuda:

 

<script language="javascript">
function Valida(form){

var ok = false;
var form = document.forms[0].chk;

for (i = 0; i < form.length; i++)	{ 
	if (form[i].checked) { 
		ok = true; 
	}
}
if (!ok) {
	alert ("Selecione algum item.");
	return false;
	}
}
</script>

<form name="form" onsubmit="return Valida(this)">
<input type="checkbox" value="1" id="chk" name="item1"> Item 1
<input type="checkbox" value="2" id="chk" name="item2"> Item 2
<input type="checkbox" value="3" id="chk" name="item3"> Item 3
<input type="checkbox" value="4" id="chk" name="item4"> Item 4
<input type="checkbox" value="5" id="chk" name="item5"> Item 5
<br><br>
<input type="submit" value="Enviar">
</form>

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.