0
I need to have the select field bring me the information that is in <%=addressable.getState()%> in which it returns "SP". In the input for city, I can get the value of <%=addressable.getCity()%> in which returns "Mogi das Cruzes" and so brings in the input this value already filled. I can’t do this for status, using value="<%=addressable.getState()%>" as in city, the state field is not returning anything, it simply goes into the first option:"select an option". Any hints on how I can take the value of <%=addressable.getState()%> and fill it automatically in select?
Note: the data contained in <%=addressgetEstado()%> and <%=addressgetCidade()%> are of the String type.
Follow the code below:
<tr>
<td><label for="cidade">Cidade:</label></td>
<td><input size="20" type="text" name="cidade" value="<%=endereco.getCidade()%>"></td>
<td><label for="uf">Estado </label></td>
<td><select type="text" name="uf" value="<%=endereco.getEstado()%>"/>
<option value="">Selecione uma opção...</option>
<option value="AC">AC</option>
<option value="AL">AL</option>
<option value="AM">AM</option>
<option value="AP">AP</option>
<option value="BA">BA</option>
<option value="CE">CE</option>
<option value="DF">DF</option>
<option value="ES">ES</option>
<option value="GO">GO</option>
<option value="MA">MA</option>
<option value="MT">MT</option>
<option value="MS">MS</option>
<option value="MG">MG</option>
<option value="PA">PA</option>
<option value="PB">PB</option>
<option value="PR">PR</option>
<option value="PE">PE</option>
<option value="PI">PI</option>
<option value="RJ">RJ</option>
<option value="RN">RN</option>
<option value="RO">RO</option>
<option value="RS">RS</option>
<option value="RR">RO</option>
<option value="SC">SC</option>
<option value="SE">SE</option>
<option value="SP">SP</option>
<option value="TO">TO</option>
</select>
</td>
It worked. I didn’t need to use any if. Only since it returns only the acronym, I changed all other options to acronyms as well. The command that worked: <select type="text" name="Uf" value="<%=addressable.getEstad()%>" id=Uf required/> <option value="<%=addressable.getEstat()%>"><%=addressable.getEstat()%></option>
– Celina Shigetomi
Thanks for your help!
– Celina Shigetomi
Relax, sorry for the confusion, I’m new here.
– Max Rogério