-1
I have two selects, both consult the database. I have Equipment, and Operations...
When selecting equipment x in select, I will consult the database for the select Operations to pull only Operations that are not in use according to the equipment I selected.
Where this "variable" in the operation query, is that I must pass what was selected in select equipments, to show only the available operations according to what I selected in the select of equipments.
but I don’t know what I should spend there as a select variable.
MY EQUIPMENT SELECT
<select name='field-number-key-COD_EQUIP' id='field-number-key-COD_EQUIP' type='text' class='form-control input-lg'lang='Equipamento,N'
onkeypress='Javascript:return only_alphabetic_acentos(this,event);' disabled >
<option value='' selected>-- Selecione --</option>
<struts_logic:iterate id="arrHH_EQUIPAMENTOS" name="collHH_EQUIPAMENTOS" scope="page" type="java.util.ArrayList">
<option value='<%=arrHH_EQUIPAMENTOS.get(0).toString()%>'
<%=arrHH_EQUIPAMENTOS.get(0).toString().equals(COD_EQUIP) ? "selected" : ""%> >
<%=arrHH_EQUIPAMENTOS.get(1).toString()%>
</option>
</struts_logic:iterate>
</select>
MY OPERATION SELECT
<select name='field-number-key-CODOPERACAO' id='field-number-key-CODOPERACAO' type='text' class='form-control input-lg' lang='Operação,N' onkeypress='Javascript:return only_alphabetic_acentos(this,event);' disabled >
<option value='' selected>-- Selecione --</option>
<struts_logic:iterate id="arrHH_OPER_CAMPO" name="collHH_OPER_CAMPO" scope="page" type="java.util.ArrayList">
<option value='<%=arrHH_OPER_CAMPO.get(0).toString()%>'
<%=arrHH_OPER_CAMPO.get(0).toString().equals(CODOPERACAO) ? "selected" : ""%> >
<%=arrHH_OPER_CAMPO.get(1).toString()%>
</option>
</struts_logic:iterate>
</select>
CONSULTATION AT THE EQUIPMENT BANK
<executequery:query resultSet="collHH_EQUIPAMENTOS" listPages="collListPagesHH_EQUIPAMENTOS"
sqlSelect="select s.codequip, s.descrequip from hh_equipamentos s where s.action<>'D' order by s.descrequip" page="0" conPool="4" >
</executequery:query>
CONSULTATION AT THE BANK FOR OPERATION
<executequery:query resultSet="collHH_OPER_CAMPO" listPages="collListPagesHH_OPER_CAMPO"
sqlSelect="SELECT CODOPERCAMPO, DESCROPERCAMPO FROM hh_oper_campo O
WHERE O.CODOPERCAMPO NOT IN (SELECT CODOPERACAO FROM MED_EQUIP M WHERE m.COD_EQUIP = <variavel>); " page="0" conPool="4" >
</executequery:query>
Your
m.COD_EQUIP
must receive the value<option value='<%=arrHH_EQUIPAMENTOS.get(0).toString()%>'
because it seems to me that this is where the code is defined. You would have to call the value of this input by the id/name. I recommend avoiding scriptlets in your code. This was used almost 20 years ago. Read at least about jstl.– rhenesys
Problem is that it is an old system I just make some changes, but as there is nothing documented and is also well outdated several things, I’m having enough difficulty in some things, I thank I will test the way you passed !
– RM08
@rhenesys this struts_logic:iterate that has the id/name is where is storing the value of options ? sorry for the question I’ve never picked up this structure before
– RM08