Avatar of enrique_aeo
enrique_aeo
 asked on

that code should I replace it if the control does not exist

hi experts, i have this code
                If WFGDH.UI.Session.FlagModCand = True Then 'TSF-CVP
                    Me.btnEnviar.Attributes.Add("onclick", "javascript:return fConfirmarRegistroTrans('" & vsReclutamiento.ValidationGroup & "','¿Desea aprobar la solicitud?','S'," + chkAceptoCambios.ClientID + "," + txtAceptaTerminos.ClientID + ",'" + txtNombreArchivoPublicar.Text.Trim + "');")

this control chkAceptoCambios.ClientID does not exits.
that code should I replace it if the control does not exist
Visual Basic.NETASP.NET

Avatar of undefined
Last Comment
enrique_aeo

8/22/2022 - Mon
Paul Jackson

You need to post the code for the function fConfirmarRegistroTrans that it is being passed as a parameter into for us to be able to determine that.
enrique_aeo

ASKER
function fConfirmarRegistroTrans(pstrValidationGroup,pstrMensaje,pAceptoTermino,pchkAceptoCambios,txtAceptaTerminos,pstrFileName){    
                                                                               
       var ctrlcbSolicitarDias = document.getElementById("tbContenedor_tab2_cbSolicitarDias");
       var ctrlcbPublicarConectate = document.getElementById("tbContenedor_tab2_cbPublicarConectate");
       
       var ctrlrfvDiasSolicitados = document.getElementById("tbContenedor_tab2_rfvDiasSolicitados");
       var ctrlrfvJustificacion = document.getElementById("tbContenedor_tab2_rfvJustificacion");
       var ctrlrfvNroDiasPublicacion = document.getElementById("tbContenedor_tab2_rfvNroDiasPublicacion");
       var ctrlrfvNombreArcConectate = document.getElementById("tbContenedor_tab2_rfvNombreArcConectate");
       var ctrlrfvTextoPublicar = document.getElementById("tbContenedor_tab2_rfvTextoPublicar");
       var ctrlrfvNombreArcConectateAux = document.getElementById("tbContenedor_tab2_rfvNombreArcConectateAux");
       var hflagActivo = document.getElementById("tbContenedor_tab1_hFlagEstado");
       var ctrltxtCantRevisionPerfil = document.getElementById("tbContenedor_tab1_txtCantRevisionPerfil");
       
       if (ctrlcbSolicitarDias != null){                
                   
           if (ctrlcbSolicitarDias.checked==false){  
           
             
               if (ctrlrfvDiasSolicitados!=null){
                 
                   ctrlrfvDiasSolicitados.enabled=false;
                   ctrlrfvDiasSolicitados.style.display='none';
                }          
               if (ctrlrfvJustificacion!=null){
                   
                  ctrlrfvJustificacion.enabled=false;
                  ctrlrfvJustificacion.style.display='none';
                }            
           }else{    
                 
               if (ctrlrfvDiasSolicitados!=null){
                   ctrlrfvDiasSolicitados.enabled=true;
                   ctrlrfvDiasSolicitados.style.display='block';
                }    
               if (ctrlrfvJustificacion!=null){
                  ctrlrfvJustificacion.enabled=true;
                  ctrlrfvJustificacion.style.display='block';
               }              
           }          
       }
       
        if (ctrlcbPublicarConectate != null){
                 
           if (ctrlcbPublicarConectate.checked==false){
            //alert("entro3");
              if (ctrlrfvNroDiasPublicacion!=null){
               ctrlrfvNroDiasPublicacion.enabled=false;
               ctrlrfvNroDiasPublicacion.style.display='none';
              }
              if (ctrlrfvNombreArcConectateAux!=null){
               ctrlrfvNombreArcConectateAux.enabled=false;  
               ctrlrfvNombreArcConectateAux.style.display='none';
              }
              if (ctrlrfvNombreArcConectate!=null){
              ctrlrfvNombreArcConectate.enabled=false;
              ctrlrfvNombreArcConectate.style.display='none';
              }
              if (ctrlrfvTextoPublicar!=null){
               ctrlrfvTextoPublicar.enabled=false;
               ctrlrfvTextoPublicar.style.display='none';
              }              
           }else{
            //alert("entro4");
              if (ctrlrfvNroDiasPublicacion!=null){
                 ctrlrfvNroDiasPublicacion.enabled=true;
                 ctrlrfvNroDiasPublicacion.style.display='block';
               }
              if (ctrlrfvTextoPublicar!=null){
                 ctrlrfvTextoPublicar.enabled=true;
                 ctrlrfvTextoPublicar.style.display='block';
              }            
               
               if (pstrFileName!=""){
                   if (ctrlrfvNombreArcConectate!=null){
                       //ctrlrfvNombreArcConectate.enabled=true;
                   }
                   if (ctrlrfvNombreArcConectateAux!=null){
                      //ctrlrfvNombreArcConectateAux.enabled=false;    
                   }            
               }else{
                  if (ctrlrfvNombreArcConectate!=null){
                      //ctrlrfvNombreArcConectate.enabled=false;
                  }
                  if (ctrlrfvNombreArcConectateAux!=null){
                     //ctrlrfvNombreArcConectateAux.enabled=true;  
                  }
                 
               }
                             
           }          
       }
       
       //ctrltxtCantRevisionPerfil.value="";
       txtAceptaTerminos.value="";
         
       
       if(pAceptoTermino=="S"){
          if (pchkAceptoCambios.checked == true){        
           txtAceptaTerminos.value="1";
           //ctrltxtCantRevisionPerfil.value="1";        
           }
       }else{        
           txtAceptaTerminos.value="1";
          // ctrltxtCantRevisionPerfil.value="1";
           hflagActivo.value="1"            
       }      
   
        if(Page_ClientValidate(pstrValidationGroup)) {
             return confirm(pstrMensaje);                        
        }        
     }  
ASKER CERTIFIED SOLUTION
Paul Jackson

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
enrique_aeo

ASKER
I do not want to change the definition of the function, then you put the code that I'm going to delete my question is how is this function given that I will not change the definition of javascript

Me.btnGrabar.Attributes.Add("onclick", "javascript:return fConfirmarRegistroTrans('','" + strMensajeGrabar + "','N'," + chkAceptoCambios.ClientID + "," + txtAceptaTerminos.ClientID + ",'" + txtNombreArchivoPublicar.Text.Trim + "');")
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
SOLUTION
Alfred A.

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
enrique_aeo

ASKER
0. ChkAceptoCambios.ClientID control is used with different javascript functions
 1. chkAceptoCambios no longer exists
 2. I will not change the number of parameters to be sent to the function in javascript
 3. How do I send a null or empty string (note that we remove the javascript code that references the control chkAceptoCambios.ClientID)
Paul Jackson

try :

Me.btnGrabar.Attributes.Add("onclick", "javascript:return fConfirmarRegistroTrans('','" + strMensajeGrabar + "','N'," + undefined + "," + txtAceptaTerminos.ClientID + ",'" + txtNombreArchivoPublicar.Text.Trim + "');")

or maybe :

Me.btnGrabar.Attributes.Add("onclick", "javascript:return fConfirmarRegistroTrans('','" + strMensajeGrabar + "','N'," + null + "," + txtAceptaTerminos.ClientID + ",'" + txtNombreArchivoPublicar.Text.Trim + "');")
SOLUTION
Alfred A.

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
enrique_aeo

ASKER
i have 2 error:
'null' is not declared. No longer supported the constant 'Null' in the database, use 'System.DBNull' instead


undefined.jpg
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.