Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/02/2008, 09:43
pali_wichis
 
Fecha de Ingreso: febrero-2008
Mensajes: 111
Antigüedad: 17 años, 2 meses
Puntos: 1
ListBox creados con javascript y llenados con xml

Aloha a todos!
Mi consulta es la siguiente:

Tengo dos listbox generados por javascript y llenados con un xml que trae toda la información desde la BD en dos arrays:elementos "habilitados" y "no habilitados".
Además, tengo al medio de ambos list dos botones, uno que elimina "<<" y otro que agrega ">>" elementos de una lista a otra. La idea es que yo pueda intercambiar datos desde una lista a otra y luego guardar los cambios.
Entonces, ahi aparece el problema porque cuando presiono el boton "modificar" se me cargan las listas con los valores originales, pese a que en la BD queda registrado el cambio.
Adjunto código y espero vuestra ayuda. Gracias!

'--------------------------------------------------------------------------
'Método para eliminar un elemento de la lista generada por el xml
'--------------------------------------------------------------------------
function BorraSeleccionOLD(p_batch,p_tabla,p_fecha)
dim Res
dim ObjCom
dim strXML

'Response.Write("p_batch:" & p_batch & "<br>")
'Response.Write("p_IdTabla:" & p_IdTabla & "<br>")
'Response.Write("p_fecha:" & p_fecha & "<br>")
'Response.End
set ObjCom = Server.CreateObject("DocumentacionAfc.clsDocBatch" )
Res=ObjCom.EliminarTabBatch(p_batch,p_tabla,p_fech a)

set ObjCom = nothing
end function
'--------------------------------------------------------------------------
'Método para guardar los elementos agregados a la lista de habilitados
'--------------------------------------------------------------------------
function GuardaCampoSel(p_IdTabla,p_batch)
dim Res
dim ObjCom
dim strXML

'Response.Write("p_IdTabla:" & p_IdTabla & "<br>")
'Response.Write("p_batch:" & p_batch & "<br>")
'Response.End
set ObjCom = Server.CreateObject("DocumentacionAfc.clsDocBatch" )
Res = ObjCom.AgregarTabBatch(p_IdTabla,p_batch)

set ObjCom = nothing
end function
'--------------------------------------------------------------------------
'Método que genera las listas a partir del xml
'--------------------------------------------------------------------------
Function EscribeListas(p_batch)
Dim objXML
Dim objXSL
Dim strXml
dim root
dim objCom
dim eliminado

set objCom = Server.CreateObject("DocumentacionAfc.clsDocBatch" )
set objXML=Server.CreateObject("MSXML2.DOMDocument")
set objXSL=Server.CreateObject("MSXML2.DOMDocument")

strXml = objCom.ConsultarBatchXML(p_batch)
'.......................................
'Response.Write("p_batch:" & p_batch & "<br>")
'Response.Write("strXml:" & strXml & "<br>")
'Response.Write strXml
'Response.End
'.......................................
objXML.loadXML(strXml)
'.......................................
'response.Write("objXML:" & objXML.xml & "<br>")
'Response.End
'.......................................
set root = objXML.documentElement
set eliminado = root.removeChild(root.childNodes.item(0))
'.......................................
'Response.Write objXML.text
'Response.Write("objXML:" & objXML.text & "<br>")
'Response.End
'.......................................
objXSL.load (Server.MapPath("AdmTablasBatch.xsl"))
contenido = objXML.transformNode(objXSL)

set objCom = nothing
set objXML = nothing
set objXSL = nothing
end function
'---------------------------------------------------------------------------------
'---------------------------------------------------------------------------------
SELECT CASE strAccion
CASE "inicio":
CALL EscribeListas(batch)

CASE "grabar":
'=================================================
dim SeleccionHab,SeleccionNoHab,arrOriginal
dim booEncontrado

SeleccionHab = Request.Form("SeleccionHab")
SeleccionNoHab = Request.Form("SeleccionNoHab")
arrOriginal = Request.Form("arrOriginal")

arrHab = split(SeleccionHab,";")
arrNoHab = split(SeleccionNoHab,";")
arrOri = split(arrOriginal,";")


'--------------------------------------------------------------------------------------------
'REVISAR FUNCIÓN : esta parte es la que compara elementos para luego
'discriminar cual fue eliminado y enviarlo a la BD
'--------------------------------------------------------------------------------------------
for i=lbound(arrOri) to ubound(arrOri)
booEncontrado = false
for j=lbound(arrHab) to ubound(arrHab)
'Response.Write "Valores : arrOri(" & i & ") -> " & arrOri(i) & "<br>"
if arrOri(i)=arrHab(j) then
booEncontrado = true
tabla= arrOri(i)
exit for
end if
next

If not booEncontrado then
'Response.Write "ID Eliminado : " & arrOri(i) & "<br>"
'response.Write("batch:" & batch & "<br>")
'response.Write("fecha:" & fecha & "<br>")
'response.Write("-------------------<br>")
'Response.End
call BorraSeleccionOLD(batch,tabla,fecha)
end if
next
'Response.Write "END"
'Response.End


'--------------------------------------------------------------------------
'Método para guardar los elementos habilitados de la lista
'---------------------------------------------------------------------------
for i=lbound(arrHab) to ubound(arrHab)
'response.Write("arreglo:" & arrHab(i) & "<br>")
Call GuardaCampoSel(batch,arrHab(i))
'Call GuardaCampoSel(batch,arrOri(i))
next

'------------------------------------------------------------
'FIN DE REVISAR FUNCIÓN
'------------------------------------------------------------
CALL EscribeListas(batch)

CASE ELSE
' llamo a cualquier otra funcion de emergencia

END SELECT