Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Olá pessoal...
Na janela pai do meu site eu chamo essa função que abre a URL /paratodos/consultas/consultaentmin.asp numa modal:
$('#dialog_trigger').click(function() {
$('#dialog').dialog('open');
});
$('#dialog').dialog({
autoOpen: false,
position: 'top' ,
title: 'Consulta de Entidade',
draggable: false,
width: 615,
height: 400,
resizable: true,
modal: true,
});
Veja o link que eu clico pra abrir a modal a partir da janela pai:
/applications/core/interface/imageproxy/imageproxy.php?img=http://www.solibras.com.br/erros/1.jpg&key=e9b5842a08c9d2e6904f690a283627c6048b5006e027f432045fde3af4173311" alt="1.jpg" />
Quando eu abro a modal eu faço uma pesquisa, veja a modal por cima da janela pai:
/applications/core/interface/imageproxy/imageproxy.php?img=http://www.solibras.com.br/erros/2.jpg&key=f5b6db4493e0c6eef30befe6063ad22dca5d15567fa74e58470dce26e915ee43" alt="2.jpg" />
Ao clicar em cima de um usuário qualquer, eu preciso mandar o código e o nome pra dentro de um input.
Detalhe.... Esse input é disabled, pois o operador do sistema não pode digitar dentro. Ele tem que pesquisar um usuário da base de dados.
/applications/core/interface/imageproxy/imageproxy.php?img=http://www.solibras.com.br/erros/3.jpg&key=34b2e801c8b229ecfbead4c62ac527253e9ea3cc5583b8efd2e8730ffd44dd35" alt="3.jpg" />
Como eu recebo esses dois valores na minha função jQuery ?
Abraços.
posta ai o html do resultado da pesquisa no modal
Hugo Sóstenes, veja aí o HTML que o modal exibe.
A dica do Everton Chapani não dá, pois o input não tá no modal e sim na página pai.
Aproveitando.... como eu fecho o modal após enviar os dados pro input ?
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='pt-br' lang='pt-br'>
<head>
<meta http-equiv='content-type' content='text/html;charset=utf-8' />
<title>solibras</title>
<link rel='stylesheet' href='/paratodos/includes/swsis.css' type='text/css' media='screen' />
<script language='javascript' type='text/javascript' src='/paratodos/includes/function0.js'></script>
<script language='javascript' type='text/javascript' src='/paratodos/includes/jquery/jquery.js'></script>
<script language='javascript' type='text/javascript'>
jQuery(document).ready(function () {
jQuery('#nomEnt').focus()
});
function fTecla(strVal, vNome) {
var MSN = true;
if (TeclaDigitada(strVal) == '13') {
if ((jQuery('#nomEnt').val() == '') && (MSN)) {
window.alert('ALERTA DO SISTEMA!\n\nDigite algum valor para Consulta');
MSN = false;
}
if (MSN) {
jQuery('#modo').val('Pesquisa');
jQuery('#IdFormLisCon').submit();
}
}
document.getElementById('nomEnt').focus();
}
</script>
</head>
<body>
<form name='altAlu' method='post' action='consultaentmin.asp' id='IdFormLisCon'>
<input type='hidden' name='modo' value='' /><table border='0'>
<tr>
<td style='height: 1px'>
</td>
</tr>
<tr>
<td>
<input style='width: 590px' type='text' name='nomEnt' id='nomEnt' class='campoinput'
value='' onkeypress='fTecla(event, this.value)' />
</td>
</tr>
</table>
<table width='100%' border='0' cellpadding='0' cellspacing='1'>
<tr>
<td style='height: 1px'>
</td>
</tr>
<tr style='height: 21px' bgcolor="#EEEEEE">
<td class='impTit' align='center' style='width: 50px' align='center'>
Seq
</td>
<td class='impTit' style='width: 100px'>
Matrícula
</td>
<td class='impTit' style='width: 450px'>
Nome
</td>
</tr>
<tr>
<td style='height: 5px;'>
</td>
</tr>
</table>
<div style='width: 600px; height: 295px; z-index: 1; overflow: auto;'>
<table width='100%' border='0' cellpadding='0' cellspacing='1'>
<tr style='height: 20px'>
<td class='seq' width='50px' align='center'>
0001
</td>
<td class='impTit2' width='100px'>
10451
</td>
<td class='impTit2' width='450px'>
<a href='#'>Mariana de Souza Fonseca</a>
</td>
</tr>
</table>
<table width='100%' border='0' cellpadding='0' cellspacing='1'>
<tr style='height: 20px'>
<td class='seq' width='50px' align='center'>
0002
</td>
<td class='impTit2' width='100px'>
10040
</td>
<td class='impTit2' width='450px'>
<a href='#'>Mariana May Franklin</a>
</td>
</tr>
</table>
<table width='100%' border='0' cellpadding='0' cellspacing='1'>
<tr style='height: 20px'>
<td class='seq' width='50px' align='center'>
0003
</td>
<td class='impTit2' width='100px'>
10111
</td>
<td class='impTit2' width='450px'>
<a href='#'>Mariana Osório Theiss Sponchiado</a>
</td>
</tr>
</table>
<table width='100%' border='0' cellpadding='0' cellspacing='1'>
<tr style='height: 20px'>
<td class='seq' width='50px' align='center'>
0004
</td>
<td class='impTit2' width='100px'>
10069
</td>
<td class='impTit2' width='450px'>
<a href='#'>Mariana Zumblick Holetz</a>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>$(document).on('click', '.impTit2 a', function(event){
var tr = $(this).closest('tr');
var matricula = $.trim(tr.children('td:eq(1)').text());
var nome = $.trim(tr.children('td:eq(2)').text());
// input fornacedor
$('input[name="fornecedor"]').val(matricula+' : '+nome);
$('#dialog').dialog('close');
});Hugo Sóstenes.... vc é bom hein...
Funcionou perfeitamente.
Valeu amigo, agora vou dar continuidade no código.
Abração.
document.getElementById("idDoInput").value = "novoValor";