Excel VBA - Web form Java submit button

deanoborn1980

New Member
Joined
Jan 10, 2013
Messages
2
Hi
I am having problems figuring out how to submit my web form. I have tried using the submit method but it does not work and seems to clear the password box. I suspect this could be because the submit button uses some java code to submit the form but my skills in coding are very limited. Any help would be much appreciated.
Code:
    Set PageForm = doc.forms(0)
    Set UserIdBox = PageForm.elements("ctl00$Menu$Username")
    
 UserIdBox.Value = Worksheets("Usernames").Range("d12").Value
    Set PasswordBox = PageForm.elements("Password")
    PasswordBox.Value = Worksheets("Usernames").Range("f12").Value
    'Submit the form (like clicking the 'Submit' button) to navigate to next page
    PageForm.submit
HTML:
 <form name="aspnetForm" method="post" action="agentlogon.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm" style="margin-top: 8px;">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKLTYwNzIyNjY0M2QYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFFmN0bDAwJE1lbnUkTG9nb25CdXR0b24WIKYosMrzNH6R77EJyHcjJ9kX4A==" />
</div>
 
******** type="text/javascript"> 
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
    theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
*********>
 
 
******** src="/WLR3.Web.App/WebResource.axd?d=wT_skd6hmOCeZ_z1VtD0By6iG5XEB4d4O7mTBty6rLnZB-EQzrk_vathCbaF_jHwMVGmgXuMbCxmg_0mplzaHVPSuHk1&t=634762837318872414" type="text/javascript">*********>
 
 
******** src="/WLR3.Web.App/WebResource.axd?d=nelpTvyt6_xRThRlc5naasz0Bwiucnv1dcqnM8ZmkL_uvNVquKq7CpfiF8uKWw8P3EHEORPd-ysReXXAqXuYB-IlhbE1&t=634762837318872414" type="text/javascript">*********>
******** type="text/javascript"> 
//<![CDATA[
function WebForm_OnSubmit() {
if (typeof(ValidatorOnSubmit) == "function" && ValidatorOnSubmit() == false) return false;
return true;
}
//]]>
*********>
 
    
        <div id="ClientHolder">
            <table style="width: 100%;" cellspacing="0" cellpadding="0">
                <tr>
                
                       
                    <td valign="top" style="width: 150px; height: 418px;">
                        
    <div id="TitleMenu" class="TitleMenu" style="width: 99%; height: 46px; margin-bottom: 10px;
        padding-bottom: 0px; border: solid 1px black; background: url('./images/header/menuheader2.gif');
        color: White;">
        <table style="height: 46px; width: 100%">
            <tr>
                <td valign="middle">
                    Agent Logon
                </td>
            </tr>
        </table>
    </div>
    <div id="NavigationMenu" class="NavigationMenu" style="margin: 0px; margin-bottom: 10px;
        padding: 10px;">
        <div style="text-align: center;">
            Username</div>
        <div style="text-align: center;">
            <input name="ctl00$Menu$Username" type="text" id="ctl00_Menu_Username" class="Text" />
        </div>
        <div style="text-align: center;">
            Password</div>
        <div style="text-align: center;">
            <input name="ctl00$Menu$Password" type="password" id="ctl00_Menu_Password" class="Text" onkeypress="capLock(event)" />
        </div>
        <span>
            <div id="divMayus" style="color: Red; visibility:hidden">
                Caps Lock is on.</div>
        </span>
        <div style="border: none; width: 100%; margin-top: 15px;">
            <center>
                <input type="image" name="ctl00$Menu$LogonButton" id="ctl00_Menu_LogonButton" src="./Images/buttons/ButtonLogon.gif" *******="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$Menu$LogonButton", "", true, "", "", false, false))" style="border-width:0px;" />
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).

Forum statistics

Threads
1,214,825
Messages
6,121,788
Members
449,049
Latest member
greyangel23

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top