Foros del Web » Programando para Internet » ASP Clásico »

no despliega valor modificado ?

Estas en el tema de no despliega valor modificado ? en el foro de ASP Clásico en Foros del Web. Bueno he hecho esta pantalla donde puedo agregar, modificar, eliminar e imprimir registros de una tabla. ahora bien , todo funciona ala perfeccion excepto que ...
  #1 (permalink)  
Antiguo 25/10/2007, 10:20
Avatar de Gaby_Corr  
Fecha de Ingreso: junio-2005
Mensajes: 672
Antigüedad: 19 años, 11 meses
Puntos: 0
no despliega valor modificado ?

Bueno he hecho esta pantalla donde puedo agregar, modificar, eliminar e imprimir
registros de una tabla.

ahora bien , todo funciona ala perfeccion excepto que si yo modifico un registro
y lo vuelvo a consultar en la misma pantalla no me despliega el valor modificado.

les pongo un ejemplo:
en mi tabla tengo 2 campos(id, nombre)
en el onblur del 1er input voy y buscoen la tabla, si esta dicho valor pues en
el 2do input lo despliego, pero loq ue hace ahorita es ponerme el valor anterior
al que yo ya modifique!! que puede estar pasando ???

les dejo mi codigo, espero que me ayuden a encontrar la falla, gracias!!!

Código:
<!-- #include file="../conexion.asp"-->

<%
Dim id_grupo, nombre, Metodform, funcion, rs

id_grupo = request.Form("grupoid")
nombre = request.Form("nombre")

Metodform = request.servervariables("REQUEST_METHOD")
funcion = request.Form("metodo")	


function grabar(id_grupo,nombre)
call conectarDB
	    sSQL = "Select * From DS_Grupos where grupos_id = "& id_grupo
		Set rs = cnn.Execute(sSQL)
		if rs.eof then			           
           sSQL = "Insert into DS_Grupos(grupos_id, grupos_nombre) VALUES ('"& id_grupo &"','"& nombre &"')"
	       cnn.Execute(sSQL)
		   Nombre = ""
	   end if
	   rs.close
	   Set rs = nothing
	   
call desconectarDB
end function


function eliminar(id_grupo,nombre)
call conectarDB
	sSQL = "Select * From DS_Grupos where grupos_id = "& id_grupo
	Set rs = cnn.Execute(sSQL)
	if not rs.eof then		 
			sSQL = "DELETE from DS_Grupos where grupos_id = "& id_grupo
			cnn.Execute(sSQL)
			Nombre = ""
	end if
    rs.close
	Set rs = nothing
call desconectarDB
end function


function actualizar(id_grupo,nombre)
call conectarDB
	sSQL = "Select * From DS_Grupos where grupos_id = "& id_grupo 
	Set rs = cnn.Execute(sSQL)
	if not rs.eof then		 
			sSQL = "UPDATE DS_Grupos SET grupos_nombre = '"& nombre &"' where grupos_id = "& id_grupo
			cnn.Execute(sSQL)
			Nombre = ""
	end if
	rs.close
	Set rs = nothing
call desconectarDB
end function




if Metodform = "POST" then
	select case funcion        
			case "Guardar"
				call grabar(id_grupo,nombre)
			case "Borrar"
				call eliminar(id_grupo,nombre)
			case "Modificar"
				call actualizar(id_grupo,nombre)
			
	end select
end if

%>

formulario dentro de <html><body>...</body></html>

Código:
	 
		<input name="grupoid" id="grupoid" type="text" value="<%=idGrupo%>" size="20" maxlength="20"  onblur="Buscar(this.id)" />
	</td><td><input name="ver" type="image" id="ver" value="submit" src="Images/20_VER1.jpg" onclick="window.open('consultasistema.asp','','width=600,height=500,status=yes,toolbar=no,menubar=no,location=no,scrollbar=yes'); return false;" /></td>
	</tr></table></td></tr>

	<tr><td>
	<br />Nombre del grupo: <br /><span class="dtobligatorio"> * </span>
		 <input name="nombre" type="text" id="nombre" value="<%=Nombre%>" size="70" maxlength="30" />
	</td>
	</tr>
	
				
	<tr><td><br /><br /></td></tr>						
	<tr><td>
				<table align="left">
		<tr>								
			<td width="167" height="36">									
				<input name="Guardar" type="image" value="submit" id="Guardar" src="images/GUARDAR1.gif"  style=" visibility: hidden;"  onclick="Metodos(this.id)" /></td>
			<td width="167" height="36">
			   <input name="Modificar" type="image" value="submit" id="Modificar" src="images/modificar1.gif" style=" visibility: hidden;" onclick="Metodos(this.id)" /></td>
			<td width="159">
			   <input name="Borrar" type="image" value="submit" id="Borrar" src="Images/ELIMINAR1.gif" style=" visibility: hidden;" onclick="Metodos(this.id)" /></td>
			<td width="72"> 
			   <input name="Imprimir" type="image" value="submit" id="Imprimir" src="images/IMPRIMIR1.gif" style=" visibility: hidden;" onclick="Imprimir(this.id)" /></td>
		</tr>
		<input type="hidden" id="metodo" name="metodo" />
		
		</table>
	</td></tr>
	<tr><td class="dtobligatorio"><br /><br />(*) Datos obligatorios </td></tr>
</table>
</form>
__________________
" Recuerda , estas donde debes estar ..."
  #2 (permalink)  
Antiguo 25/10/2007, 10:20
Avatar de Gaby_Corr  
Fecha de Ingreso: junio-2005
Mensajes: 672
Antigüedad: 19 años, 11 meses
Puntos: 0
Re: no despliega valor modificado ?

y estas son mis funciones en javascript


Código:
function getHTTPObject() {
    var xmlhttp;
    /*@cc_on
    @if (@_jscript_version >= 5)
       try {
          xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
       } catch (e) {
          try {
             xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
          } catch (E) { xmlhttp = false; }
       }
    @else
    xmlhttp = false;
    @end @*/
    if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
       try {
          xmlhttp = new XMLHttpRequest();
       } catch (e) { xmlhttp = false; }
    }
    return xmlhttp;
}

var enProceso = false; // lo usamos para ver si hay un proceso activo
var http = getHTTPObject(); // Creamos el objeto XMLHttpRequest
var strCondicion;

function handleHttpResponse() {
    if (http.readyState == 4) {
       if (http.status == 200) {
          if (http.responseText.indexOf('invalid') == -1) {
             // Armamos un array, usando la coma para separar elementos
             results = http.responseText.split(",");
			 //alert(results);
             document.getElementById("nombre").value = results[0];				 
			 strCondicion = results[1];	//alert(strCondicion); 
			 activarboton(strCondicion);		 
             enProceso = false;
			
          }
       }
    }
}

function Buscar(dato) {
    if (!enProceso && http) {
       var valor = escape(document.getElementById(dato).value);	  
       var url = "enviarGpoUser.asp?datoabuscar="+ valor;
	  // alert(valor)
       http.open("GET", url, true);
	   http.onreadystatechange = handleHttpResponse;
       enProceso = true;      
	   http.send(null);
	   // alert(url)
    }
}


function activarboton(condicion){
//alert(condicion + " hola");
if (condicion == 0){
	 document.getElementById("Guardar").style.visibility = "visible";
	 document.getElementById("Modificar").style.visibility = "hidden";
	 document.getElementById("Borrar").style.visibility = "hidden";
	 document.getElementById("Imprimir").style.visibility = "hidden"; 
 }
else{
    if(condicion == 1){
		 document.getElementById("Modificar").style.visibility = "visible";
		 document.getElementById("Borrar").style.visibility = "visible";
		 document.getElementById("Imprimir").style.visibility = "visible";
		 document.getElementById("Guardar").style.visibility = "hidden";
	}
}

}

function Metodos(idMetodo)
{
document.getElementById('metodo').value=idMetodo;
//alert(idMetodo);
document.form1.submit();
}
__________________
" Recuerda , estas donde debes estar ..."
  #3 (permalink)  
Antiguo 29/10/2007, 11:09
Avatar de Gaby_Corr  
Fecha de Ingreso: junio-2005
Mensajes: 672
Antigüedad: 19 años, 11 meses
Puntos: 0
Re: no despliega valor modificado ?

alguna idea???
__________________
" Recuerda , estas donde debes estar ..."
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 23:32.