Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Aew galera estou com um problema aqui, estou implementando o Jquery Ui numa aplicação exemplo aqui, só para tentar tornar meus Sistemas mais dinamicos.
fiz o uso do Dialog para caixas onde o usuario irá cadastrar clientes mas, como trato, digo como faço para realizar as operações de lá de dentro, tentei com o Jquery forms mas não obtive sucesso, se alguém poder mim ajudar ficarei grato.
eu tenho um dialog aonde eu carregar a pagina cadastrar.php dentro dessa pagina tem um formulario, aonde quero clickar no botao submit.
só que eu clicko e nada acontece.
esse botão é um type="submit" ?
aperte Ctrl+Shift+J no Firefox e debugue teu script.
http://wbruno.com.br/blog/2011/03/31/como-debugar-javascript-firefox-erros-comuns/
você está carregando com ajax ou com iframe ?
shuhasusa, eu sei como é o Debug do firefox, ^^ é do tipo image, porém ainda não tinha visto isso vou testar aqui, to carregando com ajax e dai não acontece nada, nem com a pagina nem no console gera erro algum, eu fiz um botão do tipo modal para quando apertar ele ativar o submit no form, deu certo porém os valores do form nao erão passados. acabei de testar nada acontece com o tipo submit também.
ok, se você está carregando com ajax, então os seus elementos foram criados dinamicamente, e ainda não tiveram o evento atrelado (possivelmente).
mostre os trechos de script para podermos analisar melhor a situação.
Cadastrar.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css"></style>
</head>
<body>
<table width="400" border="0" cellspacing="1" cellpadding="0">
<div id="dialog-form">
<form action="functions.php" method="post" id="Cadastrar" >
<tr>
<td width="109" class="text">Nome:</td>
<td width="247"> <input name="Nome" type="text" class="box" /></td>
<td width="44"> </td>
</tr>
<tr>
<td class="text">Sobrenome:</td>
<td> <input name="Sobre" type="text" class="box" /></td>
<td> </td>
</tr>
<tr>
<td class="text">Endereço:</td>
<td> <input name="Endereco" type="text" class="box" /></td>
<td> </td>
</tr>
<tr>
<td class="text">Numero:</td>
<td> <input name="Numero" type="text" class="box" /></td>
<td> </td>
</tr>
<tr>
<td class="text">CPF:</td>
<td> <input name="Cpf" type="text" class="box" /></td>
<td> </td>
</tr>
<tr>
<td colspan="3"><input type="image" src="Images/bnt.png" alt="Bnt"/><input name="Function" type="hidden" value="adicionar" /></td>
</tr>
</form>
</div>
</table>
</body>
</html>
Index.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Sistema De Pesquisa</title>
<link href="scripts/development-bundle/themes/base/jquery.ui.all.css" rel="stylesheet" type="text/css"/>
<script src="scripts/jquery-1.6.4.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script src="scripts/jquery.form.js" type="text/ecmascript"></script>
<script type="text/javascript">
$(document).ready(function() {
var opt = {
target: '#content',
sucess: showResponse
};
function showResponse(responseText, statusText, xhr, $form) document.getElementById("#content").innerHTML = responseText;
}
$('#search').submit(function(){
$(this).ajaxSubmit(opt);
return false;
});
$("#dialog #Cadastrar").submit(function(){
$(this).ajaxSubmit(opt);
return false;
});
$("#dialog").dialog({
autoOpen: false,
modal: false,
bgiframe:true,
width:500,
resizable: false ,
});
$("#Adicionar").click(function(){
$("#dialog").dialog( "option", "title", 'Cadastrar Usuários' );
$("#dialog").dialog( "open" );
return false;
});
$("#dialog").load("Cadastrar.php")
});
</script>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="dialog"></div>
<div id="site">
<div id="menu">
<ul>
<li><a href="#">Inicio</a></li>
<li><a href="#" id="Adicionar">Adicionar</a></li>
<li><a href="#">Remover</a></li>
<li>
<form action="functions.php" method="post" class="class" id="search">
<label>Consultar <input type="text" name="pesquisar" /></label>
<input type="submit" value="Pesquisar" />
<input type="hidden" name="Function" value="pesquisar" />
</form></li>
</ul>
</div>
<div id="content">
</div>
</div>
</body>
</html>aparentemente é o motivo q citei mesmo.
Conhece a função .live() ?
não.
pq você não teve sucesso ?
apareceu algum erro no console ? Ctrl+Shift+J no Firefox ?
basicamente, você pode fazer usando action normal do html, ou enviar usando javascript tb. Como se não fosse um modal, e estivesse diretamente na página, tudo igualzinho.