<form id="form1" name="form1" method="post" action="side2.php">
<p>
<label>
<input type="radio" name="bydel" value="vest" id="bydel_0" />
Oslo vest</label>
<br />
<label>
<input type="radio" name="bydel" value="ost" id="bydel_1" />
Oslo øst</label>
</p>
<p>
<label>
<input type="radio" name="bolig" value="hus" id="bolig_0" />
Hus</label>
<br />
<label>
<input type="radio" name="bolig" value="leilighet" id="bolig_1" />
Leilighet</label>
<br />
</p>
<p>
<label>
<input type="submit" name="button" id="button" value="Neste" />
</label>
<br />
</p>
</form>
function checkRadio(event) {
event.preventDefault();
if (!(document.getElementById('bydel_0').checked || document.getElementById('bydel_1').checked)) {
alert('Du må velge bydel!');
}else if (!(document.getElementById('bolig_0').checked || document.getElementById('bolig_1').checked)) {
alert('Du må velge boligtype!');
}else{
this.submit();
}
}
document.getElementById('form1').addEventListener('submit', checkRadio, false);