Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

combobox/onLoad

 
Claudia Vaz
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I have a combobox with some values (for example, Casado and Solteiro).
when i load the page the value in the combobox is the one that is in a database (i use a java class to get this information).
When this value is Casado i want to show a line with a input text for a date and when the value is Solteiro i don't want to show this line.
I though using a onLoad event:
"<tr><td><span id="span_estado_civil" style="position:relative">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td class="txtVERM"><div align="left"> Designa��o </div></td>
<td class="medium_normal">
<div align="right">
<select size="1" name="estadoCivil" class="caixasTexto" onLoad="javascript:VerificaActivacaoEstadoCivil();onChange="javascript:VerificaActivacaoEstadoCivil();">
<div class="medium_normal"><option value="Solteiro" <%=dadosBD.getEstadoCivil("Solteiro")%>>Solteiro</option></div>
<div class="medium_normal"><option value="Casado" <%=dadosBD.getEstadoCivil("Casado")%>>Casado</option></div>
</select>
</div>
<input type="hidden" name="escondida" onLoad="javascript:VerificaActivacaoEstadoCivil();>
</td>
</tr>
<tr>
<td colspan="99" bgcolor="#ffffff" height="1"><img src="images/transpar.gif"></td>
</tr>
</table>
</span></td></tr>
<tr><td><span id="span_data_estado_civil" style="position:relative">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td class="txtVERM"><div align="left"> Data do Estado Civil (DD-MM-AAAA) </div></td>
<td><img src="images/transpar.gif" height="20"></td>
<td class="txtVERM">
<div align="right" class="txt">
<input type="text" name="dataCasamento" size="11" maxlength="10" value="<%=dadosBD.getDataCasamento()%>" class="caixasTexto">
</div>
</td>
</tr>
<tr>
<td colspan="99" bgcolor="#ffffff" height="1"><img src="images/transpar.gif"></td>
</tr>
</table>
</span></td></tr>"
with the followinh function
function VerificaActivacaoEstadoCivil()
{
if (document.dadosPessoais.estadoCivil.value!="Solteiro")
{
span_data_estado_civil.style.display = "";
}
else
{
span_data_estado_civil.style.display = "none";
}
}

I hope you can help me!!!
Thanks
Claudia Vaz
 
Claudia Vaz
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I found what i was doing wrong.
the onLoad code shoul be on the body tag.
Claudia Vaz
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic