Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

JBNC

Não atualiza a pagina de formulario dentro de um div?

Recommended Posts

Fala Pessoal.

Tenho uma pagina principal em que o existe um div que o corpo da pagina.

Nele eu carrego os fomularios através de uma requisição com javascript.

Até ai nenhum problema o erro é que o formulário não esta atualizando, pois existe um campo que é numerico e ele atualiza com o último número no banco de dados mas não faz.

Como eu faço para que assim que eu caregar o formulário nesta div ele atualize o fomulário inteiro?

 

Segue abaixo o código:

 

<%@LANGUAGE="JAVASCRIPT" CODEPAGE="65001"%>
<!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>
<title>.:SAION Web:.</title>
<link href="_css/Ssaion2.css" rel="stylesheet" type="text/css" />

<!--Aqui estar o script que vai fazer o menu funcionar-->
<script language="JavaScript" type="text/javascript" src="_js/MascaraValidacao.js"></script>
<script language="javascript" type="text/javascript">
<!--
var timeout		 = 500;
var closetimer		= 0;
var ddmenuitem	  = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 
// -->
var xmlHttp, locPublic;
function showHint(str,local)
{
if (str.length==0)
  {
	document.getElementById("corpo").innerHTML="<select name='origem' style='color: #000000; font-family: Courier New; font-size: 8pt; border: solid 1px; WIDTH:100%;><option></option></select>";
	  return;
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Seu navegador nã aceita AJAX!");
  return;
  } 
var url=local;
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);

}
function stateChanged() 
{ 
if (xmlHttp.readyState==4)
{ 
	document.getElementById("corpo").innerHTML=xmlHttp.responseText;
}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
	{
	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
	}
  catch (e)
	{
	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
  }
return xmlHttp;
}
function UR_Start() 
{
	UR_Nu = new Date;
	UR_Indhold = showFilled(UR_Nu.getHours()) + ":" + showFilled(UR_Nu.getMinutes()) + ":" + showFilled(UR_Nu.getSeconds());
	document.getElementById("ur").innerHTML = UR_Indhold;
	setTimeout("UR_Start()",1000);
}
function showFilled(Value) 
{
	return (Value > 9) ? "" + Value : "0" + Value;
}
function data(){
	Hoje = new Date();
	Data = Hoje.getDate();
	Dia = Hoje.getDay();
	Mes = Hoje.getMonth();
	Ano = Hoje.getFullYear();
	
	if(Data < 10) {
		Data = "0" + Data;
	}
	NomeDia = new Array(7)
	NomeDia[0] = "domingo"
	NomeDia[1] = "segunda-feira"
	NomeDia[2] = "terça-feira"
	NomeDia[3] = "quarta-feira"
	NomeDia[4] = "quinta-feira"
	NomeDia[5] = "sexta-feira"
	NomeDia[6] = "sábado"
 
	NomeMes = new Array(12)
	NomeMes[0] = "Janeiro"
	NomeMes[1] = "Fevereiro"
	NomeMes[2] = "Março"
	NomeMes[3] = "Abril"
	NomeMes[4] = "Maio"
	NomeMes[5] = "Junho"
	NomeMes[6] = "Julho"
	NomeMes[7] = "Agosto"
	NomeMes[8] = "Setembro"
	NomeMes[9] = "Outubro"
	NomeMes[10] = "Novembro"
	NomeMes[11] = "Dezembro"
 
	document.write("Rio, "+ Data + " de " + NomeMes[Mes] + " de " + Ano);
}
</script>
</head>
<body onload="UR_Start()">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td> </td>
	<td width="90%">
		   	<div id="cabecalho" align="right" class="ff3">
			  <div>
			  </div>
			</div>
			<ul id="menu">
				<li><a href="index.asp">HOME</a></li>
				<li><a href="#" onmouseover="mopen('m2')" onmouseout="mclosetime()">AVALIAÇÃO</a>
						<div id="m2" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
							<a href="#">Fazer Avaliação</a>
							<a href="#">Gerar Analise</a>
						</div>
				</li>
				<li>
				<a href="#" onmouseover="mopen('m1')" onmouseout="mclosetime()">CADASTRAR</a>
						<div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
							<a href="#" onclick="showHint('corpo','_cad/Cad_Inst.asp');">Instituição</a>
							<a href="#" onclick="showHint('corpo','_cad/Cad_Uni.asp');">Unidade</a>
							<a href="#" onclick="showHint('corpo','_cad/Cad_Ser.asp');">Servico</a>
							<a href="#">Coleta</a>
							<a href="#" onclick="showHint('corpo','_cad/Cad_Per.asp');">Pergunta</a>
							<a href="#" onclick="showHint('corpo','_cad/Cad_Gru_Per.asp');">Grupo de pergunta</a>
							<a href="#" onclick="showHint('corpo','_cad/Cad_Ava.asp');">Avaliador</a>
							<a href="#" onclick="showHint('corpo','_cad/Cad_Que.asp');">Questionário</a>
							<a href="#" onclick="showHint('corpo','_cad/Cad_Res.asp');">Resposta</a>
					   </div>
			  </li>
				 <li><a href="#" onmouseover="mopen('m3')" onmouseout="mclosetime()">CONSULTAR</a>
						<div id="m3" onmouseover="mcancelclosetime()" onmouseout="mclosetime()">
							<a href="#">Instituição</a>
							<a href="#">Unidade</a>
							<a href="#">Servico</a>
							<a href="#">Coleta</a>
							<a href="#">Pergunta</a>
							<a href="#">Grupo de pergunta</a>
							<a href="#">Avaliador</a>
							<a href="#">Questionário</a>
							<a href="#">Resposta</a>
					   </div>
				 </li>
				 <li><a href="logo.asp">LOGOFF</a></li>
				 <li style="font-size:10px; margin: 0 0px 0 0;"><a href="logo.asp">Sobre nós?</a></li>
				 <li>
				 	<a style="width: 218px;text-align:right">
				 		<font class="ff">
						<script language="javascript">
							data();
						</script>
						</font> / 
						<font class="ff2" id="ur" size="2" face="Arial"></font>
				 	</a>
				 </li>
			</ul>
					 	
			<div id="limite"></div>
			<div id="corpo"></div>
			<div id="limite"></div>
			<div id="rodape">
				<table width="100%">
					  <tr>
						<td width="32%" align="left" colspan="2">
							Usuário:  
							<%Response.Write(Session("login"))%>  
							Tipo:  <%Response.Write(Session("tipo"))%> 
					  </td>
											</tr>
				</table>
			</div>
	</td>
	<td> </td>
  </tr>
</table>
</body>
</html>

Muito obrigado e aguardo resposta.

 

Atenciosamente.

 

JBNC. :)

Compartilhar este post


Link para o post
Compartilhar em outros sites

Ok Ted K',

O formulario é este:

 

<!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>
<title>.:SAION Web:.</title>
<link href="../_css/Ssaion2.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
.style3 {font-size: 12px}
-->
</style>
<script language="JavaScript" type="text/javascript" src="../_js/MascaraValidacao.js"></script>
<%
	Dim conexao, RS, CnPath, SQL_acesso, RS_acesso, Cod_inst
	set conexao	= Server.CreateObject("ADODB.Connection")
	Conexao.Open "driver=MySQL ODBC 3.51 Driver;DATABASE=bdsaion;SERVER=localhost;UID=root;PASSWORD=root"
	conexao.CommandTimeout = 0
	
	SQL_acesso = "SELECT Cod_instituicao FROM instituicao"
		Set RS_acesso = conexao.execute(SQL_acesso)
		

		RS_acesso.movefirst 
			While NOT RS_acesso.EOF
				Cod_inst = RS_acesso.Fields("Cod_instituicao").value
				Cod_inst = Cod_inst + 1
		RS_acesso.movenext			
			wend 
		 	RS_acesso.CLose
		 	set RS_acesso = nothing

%>
</head>
<body>
<table align="center" width="84%" height="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
	<td width="9%" height=""> </td>
	<td> </td>
	<td width="8%"> </td>
  </tr>
  <tr>
	<td> </td>
	<td width="83%">
		<div id="cabecalho" align="right" class="ff3">
		<div><br/>CADASTRAR INSTITUIÇÃO - SAION Web</div>
		</div>
		<div id="corpo" style=" height: 250px">
			  <form action="_inc/Inst_processar.asp" method="post" name="CadastrarInstituicao">
				<table align="center" width="95%"  border="0" cellspacing="0" cellpadding="0">
				  <tr>
					<td width="31%" height="47"> </td>
					<td width="17%"> </td>
					<td width="13%"> </td>
					<td width="39%"> </td>
				  </tr>
				  <tr>
					<td align="right"><label class="ff">INSTITUIÇÃO:  </label></td>
					<td align="left" colspan="3"><input name="TInsti" type="text" class="STexto " size="15" maxlength="50" style="width:300px" /></td>
				  </tr>
				  <tr>
					  <td align="right"><label class="ff">CÓDIGO:  </label></td>
					<td align="left" colspan="3"><input name="TCod" type="text" class="STexto " size="15" maxlength="50" value=<%Response.Write(Cod_inst)%> /></td>
				  </tr>
				  <tr align="left">
					<td align="right"><label class="ff">CNPJ:  </label></td>
					<td align="left" colspan="3"><input id="cnpj" name="cnpj" type="text" class="STexto " size="25" maxlength="18" onKeyPress="MascaraCNPJ(CadastrarInstituicao.cnpj);" /></td>

				  </tr>
				  <tr align="left">
					<td align="right"><label class="ff">REPRESENTANTE:  </label></td>
					<td align="left"><input name="TNomeRepre" type="text" class="STexto " size="15" maxlength="20" /></td>
				  </tr>
				  <tr>
					  <td height="35" colspan="4" class="ff" align="left">                             ENDEREÇO DA INSTITUIÇÃO:</td>
				  </tr>
				  <tr>
					<td align="right"><label class="ff">RUA:  </label></td>
					<td align="left" colspan="3"><input name="TRua" type="text" class="STexto " size="15" maxlength="20" style="width:300px"/></td>
				  </tr>
				  <tr align="left">
					<td align="right"><label class="ff">NÚMERO:  </label></td>
					<td align="left"><input name="TNum" type="text" class="STexto " size="15" maxlength="20" /></td>
				  </tr>
				  <tr>
					<td width="31%" align="right"><label class="ff">COMPLEMENTO:  </label></td>
					<td align="left" colspan="3"><input name="TCompl" type="text" class="STexto " size="15" maxlength="20" /></td>
				  </tr>
				  <tr>
					<td align="right"><label class="ff">BAIRRO:  </label></td>
					<td align="left"><input name="TBairro" type="text" class="STexto " size="15" maxlength="20" /></td>
				  </tr>
				  <tr>
					<td align="right"><label class="ff">CEP:  </label></td>
					<td align="left"><input name="cep" type="text" class="STexto " size="15" maxlength="10" onKeyPress="MascaraCep(CadastrarInstituicao.cep);" onblur="ValidarCep(CadastrarInstituicao.cep);"/></td>
				  </tr>
				  <tr>
					<td align="right"><label class="ff">CIDADE:  </label></td>
					<td align="left"><input name="TCidade" type="text" class="STexto " size="15" maxlength="20" /></td>
				  </tr>
				  <tr>
					<td align="right"><label class="ff">UF:  </label></td>
					<td align="left">
						<% SQL_acesso = "SELECT * FROM uf ORDER by Sigla_UF asc"
						   Set RS_acesso = conexao.execute(SQL_acesso)%>
						<select name="uf" class="STexto" size="1" tabindex="1" style="width: 95px; font-size:11px">
						<option>-Selecione-</option>
		 				<% RS_acesso.movefirst 
						While NOT RS_acesso.EOF %>
							<% Response.Write "<option value='"&RS_acesso("Sigla_UF")&"'>"&RS_acesso("Sigla_UF")&"</option>"%>
						  <% RS_acesso.movenext %>
						  <% wend 
		 					RS_acesso.CLose
		 					set RS_acesso = nothing
						  %>
					</select>
					</td>
				  </tr>
				  <tr>
					<td align="right"><label class="ff">CURSOS:  </label></td>
					<td align="left"><input name="TCurso" type="text" class="STexto " size="15" maxlength="20" /></td>
				  </tr>
				  <tr>
					<td align="right"><label class="ff">TELEFONE:  </label></td>
					<td align="left"><input name="tel" type="text" class="STexto " size="15" maxlength="15" onKeyPress="MascaraTelefone(CadastrarInstituicao.tel);" onblur="ValidarTelefone(CadastrarInstituicao.tel);"/></td>
				  </tr>
				  <tr>
					<td height="41" align="right"> </td>
					<td align="right"> </td>
					<td align="right"> </td>
					<td align="left"><input name="BLogin" type="submit" class="SButton2" value="SALVAR"/>
						<input name="BCancel" type="reset" class="SButton2" value="LIMPAR"/></td>
				  </tr>
				</table>
	   		  </form>
	  </div>
	<div id="rodape" style="font:bold 9px arial"> </div>	</td>
	<td> </td>
  </tr>
  <tr>
	<td> </td>
	<td> </td>
	<td> </td>
  </tr>
</table>
</body>
</html>

Obs.: Não tem só este formulario tem mais outros que devo fazer.

Muito obrigado e aguardo resposta.

 

Atenciosamente

 

JBNC.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tem esse sistema online para que possamos visualizar o problema?

Compartilhar este post


Link para o post
Compartilhar em outros sites

ja tentou passar por session !?!

Compartilhar este post


Link para o post
Compartilhar em outros sites

Prezados Salgado e xanburzum,

Com relação ao questionamento do Salgado este sistema estou fazendo na minha maquina de casa e não esta on-line ainda.

E ao xanburzum como seria feito com a session, pois a requisição das paginas é feito em javascript que coloca a pagina requisitada no DIV "corpo" mas as paginas que são formularios não estão atualizadas.

Eu afirmo isto pois destas paginas tem "select" que criam listas de seleções mais se no banco de dados tiver uma novo dado que terá que ser carregado para este "select" ele fica com a lista de seleção desatualizada.

Por favor me ajudem a resolver este problema tão dificil.

Muito obrigado e aguardo resposta.

 

Atenciosamente.

 

JBNC... http://forum.imasters.com.br/public/style_emoticons/default/natal_smile.gif

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.