Pegar retorno de pop up

0 respostas
hfk

Bom dia/tarde/noite/madrugada

Pessoal sera que alguem poderia me dar uma ajudinha com probleminha ?
É o seguinte fiz uma pagina e um popup para pesquisar cliente usando vraptor3, preciso que ao pesquisar um cliente eu consiga jogar o nome e codigo dele na pagna pai.
Ate ai sem misterio consegui fazer, so que o problema é o seguinte quando no meu popup é apresentado uma grade com varios cliente e eu seleciono o que eu quero, o sistema joga no pagna pai somente o primeiro cliente da grade, alguem poderia me explicar como eu jogo o cliente selecionado?

segue abaixo meu pop.

<%-- 
    Document   : pesquisaCliente
    Created on : 03/05/2012, 23:06:50
    Author     : Silas
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@page contentType="text/html" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <title>JSP Page</title>
    </head>
    <body>
        <script language="JavaScript">  
            function putData() {  
                var codigo = document.getElementById('cdg').value;  
                var nome = document.getElementById('nomeC').value;  
                window.opener.document.getElementById('venda.cliente.codigo').value = codigo;  
                window.opener.document.getElementById('venda.cliente.nome').value = nome;  
                
                window.close();  
            }  
        </script>

        <h1>pesquisa cliente</h1>

        <form action="<c:url value="/venda/buscarCliente"/>">

            <table >
                <tr>
                    <td>
                        <select id="sTipoPesquisa" name="sTipoPesquisa">
                            <option value="codigo">Codigo</option>
                            <option value="nome">Nome</option>
                        </select>
                    </td>
                    <td>
                        <input type="text" name="sValorPesquisa"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <input type="submit" value="Pesquisar"/>
                    </td>
                </tr>
            </table>



            <div id="tabelinha" style=" width:800px ; height: 300px;  overflow: scroll; border: 0px solid;">

                <table border="1" style=" width:2800px">

                    <thead  >
                    <th width="300">Nome</th>
                    <th>Fantasia</th>
                    <th>Email</th>
                    <th>Telefone Residencia</th>
                    <th>Telefone Celular</th>
                    <th>Telefone Comercial</th>
                    <th>CPF</th>
                    <th>CNPJ</th>
                    <th>Rua</th>
                    <th>Bairro</th>
                    <th>Numero</th>
                    <th>Estado</th>
                    <th>Cidade</th>
                    <th>Status</th>
                    <th>Tipo</th>
                    <th>Insc Estadual</th>
                    <th>Insc Est Sub Tri</th>
                    <th>Insc Municipal</th>
                    <th>Insc Suframa</th>
                    <th>Grupo</th>
                    </thead>

                    <c:forEach items="${lista}" var="c">
                        <tr>
                            <td>${c.nome}</td>
                            <td>${c.fantasia}</td>
                            <td>${c.email}</td>
                            <td>${c.telRes}</td>
                            <td>${c.telCel}</td>
                            <td>${c.telCom}</td>
                            <td>${c.cpf}</td>
                            <td>${c.cnpj}</td>
                            <td>${c.rua}</td>
                            <td>${c.bairro}</td>
                            <td>${c.num}</td>
                            <td>${c.estado}</td>
                            <td>${c.cidade}</td>
                            <td>${c.status}</td>
                            <td>${c.tipo}</td>
                            <td>${c.inscEst}</td>
                            <td>${c.inscEstSubTrib}</td>
                            <td>${c.inscMun}</td>
                            <td>${c.inscSufra}</td>
                            <td>${c.grupo.descricao}</td>
                            <td>
                                <form id="form_popup">
                                    <!-- Estes hiddens serao passados para a pagina pai que chamou o pop up -->
                                    <input type="hidden" id="cdg" value="${c.codigo}"/>
                                    <input type="hidden" id="nomeC" value="${c.nome}"/>   
                                    <button onclick="putData()">
                                        <img src="../images/alterar.png" style="text-align: center;" />
                                    </button> 
                                </form>
                            </td>
                        </tr>
                    </c:forEach>

                </table>

            </div>
        </form>


    </body>
</html>

se alguem puder me ajudar fico grato. :XD:

Criado 5 de maio de 2012
Respostas 0
Participantes 1