[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 304
  • Last Modified:

intercept the commAnd clcik

Hi have this code and the html page, i cannot intercept the command to confirm da value inserted in login with click:
Sub PROVA()

' Prepare to open the web page
   Set ie = CreateObject("InternetExplorer.Application")

   With ie
       .Visible = True
       .Navigate "http://crediti/cr/html/logon/logonAutenticazione.html"

       '.Navigate "http://crediti/cr/html/menu/"
       
' Loop until the page is fully loaded
        Do Until Not .Busy
            DoEvents
        Loop
   
' Make the desired selections on the web page and click the submit Button
       ' IE ie.document.all.Item LEGGE NELLA PAGINA html il tag di riferimento
       Set ipf = ie.document.all.Item("USER-ID_0")
           ipf.Value = Range("a1") '.Value
       Set ipf = ie.document.all.Item("PASSWORD_0")
           ipf.Value = Range("b1") '.Value
       'Set ipf = ie.document.all.Item("CHOICE")
           'ipf.Value = Range("c1") '.Value
           ???????????????????????????????
           ipf.Click
           ??????????????????????????????
' Loop until the page is fully loaded
       Do Until Not .Busy
           DoEvents
       Loop
   
   End With
==================================

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<!-- Versione: 3.1.3.2004-09-27.0.BNL -->
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<META http-equiv="Content-Style-Type" content="text/css">
<META name="GENERATOR" content="IBM WebSphere Page Designer V3.0.2 for Windows">
<LINK href="/cr/theme/concentratore.css" rel="stylesheet" type="text/css">
</HEAD>
<BODY>
<script language="JavaScript1.2">
parent.autenticazione = null;

function controllaCredenziali() {

    var userID = document.FormDati.elements["USER-ID_0"].value.replace(/ /gi, "");
    var password = document.FormDati.elements["PASSWORD_0"].value.replace(/ /gi, "");
    var risultato = true;
    if ((userID == "") || (password == "")) {
        risultato = false;
    }
    return risultato;
}

function connect() {

    if (controllaCredenziali()) {
        document.forms[0].elements["SYS-ID-UTENTE_0"].value = document.forms[0].elements["USER-ID_0"].value;
        document.forms[0].submit();
    } else {
        alert ("Non hai inserito User ID o Password!");
    }
}

function onClickApriCambioPassword() {

    parent.FrameDati.location = '/cr/html/logon/logonCambioPassword.html';
    parent.FrameErrori.location = '/cr/html/blank.html';
}

</script>
<h1>BNL Loan Services</h1>
<form name="FormDati" method="POST" action="/cr/ServletControllerAutenticazione">
<!-- Servlet Controller Autenticazione -->
<input type="hidden" name="IS-CAMBIO-PASSWORD-RICHIESTO" value="N">
<!-- Area Tecnica RB -->
<INPUT type="hidden" name="SYS-ID-UTENTE_0" value="">
<INPUT type="hidden" name="SYS-ID-LINGUA_0" value="ITA">
<INPUT type="hidden" name="SYS-CANALE-LOGICO_0" value="">
<!-- Area Applicativa Autenticazione - Da Personalizzare (CBS) -->
<input type="hidden" name="NOME-SISTEMA_0" value="">
<!-- Inizializzazione dati per scelta banca -->
<input type="hidden" name="CD-CXS_0" value="">
<input type="hidden" name="CODICE-BANCA_0" value="">
<table>
    <tr>
      <td class='EtichettaDescrizione'>User ID</td>
      <td><input type="text" class="InputText" size="10" name="USER-ID_0" maxlength="8"></td>
    </tr>
    <tr>
      <td class='EtichettaDescrizione'>Password</td>
      <td class='CampoVisibile'><input type="password" class="InputPassword" size="10" name="PASSWORD_0" maxlength="8"></td>
    </tr>
   <tr>
      <td><A class='Button' HREF='javascript:void(0);' onClick='connect();return false;'>CONNETTI</A></td>
      <td><A class='Button' HREF='javascript:void(0);' onClick='onClickApriCambioPassword();return false;'>CAMBIA PASSWORD</A></td>
   </tr>
 </table>
</form>
</BODY>
</HTML>
0
sal21
Asked:
sal21
  • 3
  • 2
1 Solution
 
TimCotteeCommented:
Hi sal21,

ie.document.forms[0].submit()

Tim Cottee
0
 
sal21Author Commented:
Error run time 424....
0
 
TimCotteeCommented:
sal21,

Then perhaps

ie.document.forms(0).submit
or
ie.document.frmdati.submit

will work for you

Tim
0
 
sal21Author Commented:
WORK!!!!!!!!!

        IE.Document.forms(0).submit

... but have experince and "time" on web and VBA?
0
 
TimCotteeCommented:
sal21,

Glad it worked. The reason it works is because the button itself doesn't have a click method, just a click event which normally submits the form. All the line of code does that works is to submit that form directly.

Tim
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now