PDA

View Full Version : IE submit - nearly working



theta
02-24-2012, 07:39 AM
Hi all...I got some VBA code working. It allows me to auto login to an .aspx URL on the company intranet. I can now hotlink directly to a reporting screen to provide me with the required data. I cannot get it to submit though :(

Normally you select the item from the dropdown. This does a 'doPostBack' and the item selected becomes <selected = "selected">.

Here are the objects I am using, but not sure how to get it to post (the "<< View >>" button does not appear until a manual selection is made on the dropdown - setting the value doesn't work)

Form = 'frmReport'
Report List = 'ddlCrystalReportList'
Submit = 'butSubmit' <=== the "<< View >>" button
Report needed = "170" <=== the "IOT Credit Note Report"

This is the vba


Sub Get_Report()

Dim IE As Object, MyPass As String, MyLogin As String
IE.Visible = True 'False
IE.Navigate "http://fcss.unitedclearing.net/Reporting/VerificationChecks.aspx?categoryID=2"
'Loop until ie page is fully loaded
Do Until IE.readyState = 4 '4=READYSTATE_COMPLETE
DoEvents
Loop
With IE.Document.Forms("frmReport")
.Item("ddlCrystalReportList").Value = "170"
' Submit "butSubmit" "<< View >>"
End With
Set IE = Nothing
End Sub



Here is the source code for the page. Has all object and java within it. Can you call java processes from VBA?




<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Event List</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<LINK href="../common/StyleSheet/Fcss01.css" type="text/css" rel="stylesheet">
<LINK href="../common/StyleSheet/Fcss02.css" type="text/css" rel="stylesheet">
<script language="javascript">
<!--


function DocumentOnLoad()
{
window.parent.frames(1).document.all("TopTitle").innerText="Internal Reports";
}

function DocumentOnUnload()
{
window.parent.frames(1).document.all("TopTitle").innerText="";
window.parent.frames(1).document.all("TopTitle").style.display="";
}


function SelectReport(){
document.frmReport.ReportTag.value = "Y"
}

//-->

</script>
</HEAD>
<body leftMargin="0" topMargin="0" onload="DocumentOnLoad();" onunload="DocumentOnUnload();"
MARGINHEIGHT="0" MARGINWIDTH="0" MS_POSITIONING="GridLayout">
<form name="frmReport" method="post" action="VerificationChecks.aspx?categoryID=2" language="javascript" onsubmit="if (!ValidatorOnSubmit()) return false;" id="frmReport">
<input type="hidden" name="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" value="ridiculously large mix of characters" />

<script language="javascript" type="text/javascript">
<!--
function __doPostBack(eventTarget, eventArgument) {
var theform;
if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
theform = document.frmReport;
}
else {
theform = document.forms["frmReport"];
}
theform.__EVENTTARGET.value = eventTarget.split("$").join(":");
theform.__EVENTARGUMENT.value = eventArgument;
theform.submit();
}
// -->
</script>

<script language="javascript" type="text/javascript" src="/aspnet_client/system_web/1_1_4322/WebUIValidation.js"></script>


<table height="100%" cellSpacing="0" cellPadding="0" width="100%" align="center" border="0">
<TR>
<TD class="cdataEntTable1" width="10"><IMG alt="-" src="../common/images/dot.gif" width="10"></TD>
<TD class="cdataEntTable1" vAlign="top" align="center" width="100%" height="100%">
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="100" height="7"><IMG height="7" alt="-" hspace="0" src="../../common/images/dot.gif" width="100%" border="0"></TD>
</TR>
</TABLE>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD class="ctxSubTitle" width="100%"><input type="image" name="btnEntryMinus" id="btnEntryMinus" src="../common/images/minus.gif" alt="" border="0" />&nbsp;
<span id="lblDataEntryTitle">Verification Reports</span></TD>
</TR>
</TABLE>
<div id="PanEntryCollapse">

<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="100" colSpan="2" height="5"><IMG height="5" alt="-" hspace="0" src="../common/images/dot.gif" width="100%" border="0"></TD>
</TR>
<TR>
<TD class="ctxSubTitleDiffCol1">Report:</TD>
</TR>
<TR>
<TD>
<select name="ddlCrystalReportList" onchange="SelectReport();__doPostBack('ddlCrystalReportList','')" language="javascript" id="ddlCrystalReportList">
<option value="">--Select--</option>
<option value="120"> GSM and SMS Missing Invoices By Clearing House</option>
<option value="83">Agreement List BY Client</option>
<option value="1">All Missing Payable Invoices </option>
<option value="138">Allocation Position Currency Detail Report</option>
<option value="2">Allocations over last 7 days</option>
<option value="110">Applied CN and DN Payable</option>
<option value="111">Applied CN and DN Receivable</option>
<option value="3">Audit Event Today</option>
<option value="97">BHSBH GSM Oustanding Ageing Details</option>
<option value="87">BRABT Gross Pay Status</option>
<option value="88">BRABT Gross Payable</option>
<option value="89">BRABT Gross Payable Settled</option>
<option value="91">BRABT Gross Receivable</option>
<option value="92">BRABT Gross Receivable Settled</option>
<option value="90">BRABT Gross Receivable Status</option>
<option value="95">BUBA2 YUG Pay This Month</option>
<option value="93">BUBA2 - DEUE2 V3</option>
<option value="94">BUBA2 - DEUO2 V3</option>
<option value="96">BUBA2 YUG Receive This Month</option>
<option value="106">CHLMV Receivable Tap Detail Report</option>
<option value="145">CLIENT TO CLIENT AGREEMENT</option>
<option value="146">CLIENT TO CLIENT POSITIONS</option>
<option value="4">Client Receipts not allocated</option>
<option value="157">Credit And Debit Note Details</option>
<option value="156">Credit And Debit Note Summary</option>
<option value="151">Credit Note And Debit Note Report</option>
<option value="147">DATA LOADED FOR INVOICE PRINTING</option>
<option value="148">DATA LOADING POSITION NOT CREATED EXCEPTIONS</option>
<option value="132">Daily Allocation Detail Report</option>
<option value="134">Daily Allocation Summary Report</option>
<option value="169">Data Purge Log Report</option>
<option value="168">Date Based Receipt Report</option>
<option value="43">Difference Between DEAL_LIST and SETTLEMENT REPORTING AMOUNT</option>
<option value="44">Difference Between DEAL_LIST and SETTLEMENT REPORTING POSITIONS</option>
<option value="5">Double Payment SDR Check</option>
<option value="6">Double Payment TAP Check</option>
<option value="7">Duplicated Payments</option>
<option value="163">EID Payable Invoices Log Report</option>
<option value="161">EID Receivable Invoices Log Report</option>
<option value="162">EID Receivable Invoices Acknowledgement Log Report</option>
<option value="160">EID Receivable Invoices Summary</option>
<option value="133">ESPRT Age Debt Report</option>
<option value="98">FRAGS GSM Oustanding Ageing Details</option>
<option value="71">Financial Director FX Report</option>
<option value="113">Financial Director FX Report For Indicative</option>
<option value="66">GBRCN Service Summary Report</option>
<option value="69">GBRJT GSM Outstanding Report</option>
<option value="70">GBRJT SMS Outstanding Report</option>
<option value="131">GSM Client To Client Approved Invoices Report</option>
<option value="67">GSM Outstanding Report</option>
<option value="64">GSM Payable Reconciliation Progress </option>
<option value="121">GSM Reconciliation Report Check for UAT OR Live</option>
<option selected="selected" value="170">IOT Credit Note Report</option>
<option value="144">Invoice VAT Report DEUE2</option>
<option value="149">Invoice VAT Report GBRHU</option>
<option value="141">Invoice VAT Report GBROR</option>
<option value="150">Invoice VAT Report IRLDF</option>
<option value="84">Loaded Payable Invoice List </option>
<option value="10">Missing Agreement For Data Loading </option>
<option value="11">Missing Payable Invoices from Current Traffic Period</option>
<option value="137">Missing Service IDs Report</option>
<option value="12">Not Received or Approved SVR Client to SVR Client</option>
<option value="139">Open Receipt Detail Report</option>
<option value="164">PNR Not Sent Log Report</option>
<option value="165">PNR Sent Log Report</option>
<option value="13">Payable Invoices Received Not Approved</option>
<option value="107">Payable Invoices Received, missing TAP (SAP IN)</option>
<option value="105">Payable Rap Summary</option>
<option value="99">Payable Reconciliation Check</option>
<option value="14">Payable Reconciliation Summary</option>
<option value="15">Payables Invoices Not Received and Not Approved</option>
<option value="153">Payment Promise Report</option>
<option value="16">Payments List vs. Settlements Table</option>
<option value="17">Position Vs Settlement Reporting</option>
<option value="18">Possible Duplicate GSM Payments</option>
<option value="19">Possible Duplicate SMS Payments</option>
<option value="20">Post Settlement Deal List vs Payment List</option>
<option value="21">Pre Settlement Deal List vs Payment List</option>
<option value="155">RTDR 610 Receivable Comparison Report</option>
<option value="42">Receivable non sequential TAPS</option>
<option value="158">Reconciliation Miss Match Currency Report</option>
<option value="140">SCB Control Log Report</option>
<option value="22">SDR Rates Necessary Based On Agreements</option>
<option value="122">SMS Message Terminated Report</option>
<option value="68">SMS Outstanding Report</option>
<option value="65">SMS Payable Reconciliation Progress </option>
<option value="142">SMS REPORT BY VALUE</option>
<option value="143">SMS REPORT BY VOLUME</option>
<option value="24">SMS Settlements Table vs. Deal List</option>
<option value="23">Settlements Table vs. Deal List</option>
<option value="154">Statement of Account Report</option>
<option value="118">Sum of GSM Held Positions Report</option>
<option value="116">Sum of Invoices Not Approved GSM Report</option>
<option value="117">Sum of Invoices Not Approved SMS Report</option>
<option value="119">Sum of SMS Held Positions Report</option>
<option value="115">Sum of invoices not received GSM Report</option>
<option value="114">Sum of invoices not received SMS Report</option>
<option value="166">TGR Cycle Overview Payables</option>
<option value="167">TGR Cycle Overview Receivables</option>
<option value="25">Today's Ops Log</option>
<option value="109">Un Applied CN Application</option>
<option value="26">Unapproved SVR Client to SVR Client</option>
<option value="136">Zero Invoices Approved Report</option>
<option value="135">Zero Invoices Not Approved Report</option>

</select>
<span id="rfvCrystalReport" class="errorQuickTxt" controltovalidate="ddlCrystalReportList" errormessage="Please select a Report" display="Dynamic" evaluationfunction="RequiredFieldValidatorEvaluateIsValid" initialvalue="" style="color:Red;display:none;">*</span></TD>
</TR>
<TR>
<TD width="100" colSpan="2" height="5"><IMG height="5" alt="-" hspace="0" src="../common/images/dot.gif" width="100%" border="0"></TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
<div id="palParameters">

<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="100" height="7"><IMG height="7" alt="-" hspace="0" src="../common/images/dot.gif" width="100%" border="0"></TD>
</TR>
</TABLE>






<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="100%" height="10"><IMG height="10" alt="-" hspace="0" src="../common/images/dot.gif" width="100%" border="0"></TD>
</TR>
</TABLE>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="100%">
<div id="vsError" headertext="The following error(s) have occurred" style="color:Red;display:none;">

</div></TD>
</TR>
</TABLE>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="100%" height="10"><IMG height="10" alt="-" hspace="0" src="../common/images/dot.gif" width="100%" border="0"></TD>
</TR>
</TABLE>
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="100%" height="7">
<input type="submit" name="butSubmit" value="<< View>>" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="butSubmit" class="cSubmitbuttonStyle" />
<input type="submit" name="btnExport" value="<< Export >>" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="btnExport" class="cSubmitbuttonStyle" /></TD>
</TR>
</TABLE>

</div>

</div> <!--Collapse-->
<TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR>
<TD width="100" height="10"><IMG height="10" alt="-" hspace="0" src="../common/images/dot.gif" width="100%" border="0"></TD>
</TR>
</TABLE>
<HR>

<TD class="cdataEntTable1" width="10"><IMG alt="-" src="../common/images/dot.gif" width="10"></TD>
</TR>
</table>
<input id="ReportTag" type="hidden" name="ReportTag">

<script language="javascript" type="text/javascript">
<!--
var Page_ValidationSummaries = new Array(document.all["vsError"]);
var Page_Validators = new Array(document.all["rfvCrystalReport"]);
// -->
</script>


<script language="javascript" type="text/javascript">
<!--
var Page_ValidationActive = false;
if (typeof(clientInformation) != "undefined" && clientInformation.appName.indexOf("Explorer") != -1) {
if ((typeof(Page_ValidationVer) != "undefined") && (Page_ValidationVer == "125"))
ValidatorOnLoad();
}

function ValidatorOnSubmit() {
if (Page_ValidationActive) {
return ValidatorCommonOnSubmit();
}
return true;
}
// -->
</script>


</form>
</body>
</HTML>

theta
02-24-2012, 07:40 AM
When the item is selected manually, the post back produces :



<option value="67">GSM Outstanding Report</option>
<option value="64">GSM Payable Reconciliation Progress </option>
<option value="121">GSM Reconciliation Report Check for UAT OR Live</option>
<option selected="selected" value="170">IOT Credit Note Report</option>