Html form submit multiplo

1 resposta
X

boas,

tenho um procedimento em PLSQL com HTML mixado, onde existe um FORM com varias combo box, de selecção multipla, qual é a forma mais simpatica de subter a selecção multipla de cada uma das combo box para um outro formulario, ou procedimento PLSQL ??

Um exemplo ajudaria bastante !? Em seguida tem o FORM de que já falei…

– criar página para actualizar dados de um filme
procedure editarTitulo(p_fl_master_id in number) is

cursor c_filme is
select * from filme
where fl_master_id = p_fl_master_id;

cursor c_actor is
select * from actor
where act_cod in
(select act_fl_cod from actor_filme
where act_fl_master_id =
(select fl_master_id from filme
where fl_master_id = p_fl_master_id));

cursor c_realizador is
select * from realizador
where rl_cod =
(select fl_rl_cod from filme
where fl_master_id = p_fl_master_id);

cursor c_legenda is
select * from idioma_legenda
where idm_leg_id in
(select leg_id from legenda
where leg_fl_master_id =
(select fl_master_id from filme
where fl_master_id = p_fl_master_id));

cursor c_idioma is
select * from idioma_legenda
where idm_leg_id in
(select idm_leg_id from idioma
where idm_fl_master_id =
(select fl_master_id from filme
where fl_master_id = p_fl_master_id));

cursor c_categoria is
select * from categoria
where cat_id =
(select fl_cat_id from filme
where fl_master_id = p_fl_master_id);

cursor c_genero is
select * from genero
where gen_id =
(select fl_gen_id from filme
where fl_master_id = p_fl_master_id);

r_filme c_filme%rowtype;
r_realizador c_realizador%rowtype;

begin

open c_realizador;

fetch c_realizador into r_realizador;

close c_realizador;

open c_filme;

fetch c_filme into r_filme;

close c_filme;

htp.p(’<html>’);

htp.p(’

<body>

<h2>Alterar/Apagar filme </h2>

<form action=“ei13.actualizarFilme” method=“post”>

<input type=“hidden” name=“p_fl_master_id” value="’||r_filme.fl_master_id||’">

<table>

<tr>

<td>Titulo:</td><td><input type=“text” size=“50” name=“p_fl_titulo” value="’||r_filme.fl_titulo||’"></td>

</tr>

<tr>

<td>Actores:</td>

<td><select name=“p_act_cod”>

‘);

for r_actor in c_actor loop

htp.p(’<option value="’||r_actor.act_cod||’">’||r_actor.act_prim_nome||’ ‘||r_actor.act_ult_nome);

end loop;

htp.p(’

</select>

<input type=“button” value="…" onclick=“window.location=’‘ei13.gerirActor’’;”>

</td>

</tr>

<tr>

<td>Realizador:</td><td><input type=“text” size=“50” name=“p_fl_rl_cod” value="’||r_realizador.rl_prim_nome||’ ‘||r_realizador.rl_ult_nome||’">

<input type=“button” value="…" onclick=“window.location=’‘ei13.gerirRealizador’’;”></td>

</tr>

<tr>

<td>Genero:</td>

<td><select name=“p_gen_id”>

‘);

for r_genero in c_genero loop

htp.p(’<option value="’||r_genero.gen_id||’">’||r_genero.gen_fl_cod);

end loop;

htp.p(’

</select>

<input type=“button” value="…" onclick=“window.location=’‘ei13.gerirGenero’’;”>

</td>

</tr>

<tr>

<td>Categoria:</td>

<td><select name=“p_cat_id”>

‘);

for r_categoria in c_categoria loop

htp.p(’<option value="’||r_categoria.cat_id||’">’||r_categoria.cat_fl_cod);

end loop;

htp.p(’

</select>

<input type=“button” value="…" onclick=“window.location=’‘ei13.gerirCategoria’’;”>

</td>

</tr>

<td>Legenda:</td>

<td><select name=“p_idm_leg_id”>

‘);

for r_legenda in c_legenda loop

htp.p(’<option value="’||r_legenda.idm_leg_id||’">’||r_legenda.idm_leg_cod);

end loop;

htp.p(’

</select>

<input type=“button” value="…" onclick=“window.location=’‘ei13.gerirLegenda’’;”>

</td>

</tr>

<td>Idioma:</td>

<td><select name=“p_idm_leg_id”>

‘);

for r_idioma in c_idioma loop

htp.p(’<option value="’||r_idioma.idm_leg_id||’">’||r_idioma.idm_leg_cod);

end loop;

htp.p(’

</select>

<input type=“button” value="…" onclick=“window.location=’‘ei13.gerirIdioma’’;”>

</td>

</tr>

<tr>

<td>Ano Producao:</td><td><input type=“text” size=“50” name=“p_fl_ano_prod” value="’||r_filme.fl_ano_prod||’"></td>

</tr>

<tr>

<td align=“center” colspan=“2”>

<input type=“submit” value=“Alterar”>;

<input type=“button” value=“Apagar” onclick=“window.location=’‘ei13.apagarfilme?p_fl_master_id=’||r_filme.fl_master_id||’’’;”>;

<input type=“button” value=“Voltar” onclick=“window.location=’‘ei13.gerirClientes’’;”>

</td>

</tr>

</table>

</form>

</body>

</html>

');

end;

1 Resposta

tecdanilo

Eu faria o tratamento no onsubmit do forumulário e enviaria os valores separados por vírgula;

<script>
   function formataDados(){
        var valores="";
       // valores += "1,"
       // até q sejam coletados todos valores selecionados
       // no final teremos valores -> "1,2,3,4,5,...,n";
      document.getElementById("values").value = valores;
   }
<script>

<form action="seilah.jsp" method="post" onSubmit="javascript: formataDados(); " >
  <input type="hidden" id="values" name="values">
  <!-- seus campos -->
</form>

Depois é só usar na página ou servlet que processa a requisição: request.getParameter(values).toString().split(","); para ter um array de String
com os valores separados nas posições do array.

Espero que isto sirva.

Criado 24 de janeiro de 2008
Ultima resposta 24 de jan. de 2008
Respostas 1
Participantes 2