Hello all,

I have mechanized a site using LWP and Mechanize that has been working
for about a year, but now no longer does.  The site owner has made some
recent changes, but I think mechanize, or more precisely HTML::form
might be having trouble parsing the page and I'd like to find out why.

In order to make the form work, I set the __EVENTTARGET hidden field to
a certain value, but as of this week, the script dies with:

$self->mech->field('__EVENTTARGET',
'ChangeViewControl1$ImpersonateCommand');
No such field '__EVENTTARGET' at
/usr/lib/perl5/site_perl/5.8.7/WWW/Mechanize.pm line 1247

Sure enough, a form dump no longer shows the __EVENTTARGET field,
however, the 'view source' from firefox shows that there are several
hidden fields created.  Notably, the first three that are blank,
__EVENTTARGET, __EVENTARGUMENT, and __LASTFOCUS are all missing from the
form dump.  __VIEWSTATE and __EVENTVALIDATION are both fine.

Here is a sample of the page source causing the trouble:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
        <HEAD>
                <TITLE>IIG - Commission </TITLE>
                <META CONTENT="Microsoft Visual Studio 7.0"
NAME="GENERATOR">
                <META CONTENT="C#" NAME="CODE_LANGUAGE">
                <META CONTENT="JavaScript"
NAME="vs_defaultClientScript">
                <META
CONTENT="http://schemas.microsoft.com/intellisense/ie5";
NAME="vs_targetSchema">
                <LINK rel="stylesheet" type="text/css"
href="/iig/Includes/content.css">

                <LINK rel="stylesheet" type="text/css"
href="/iig/Includes/design.css">
        </HEAD>
        <BODY BACKGROUND="/IIG/images/graphics/LeftnavBG.gif">
                <form name="BM_COMMISSION" method="post"
action="BM_Commission.aspx" id="BM_COMMISSION">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT"
value="" />
<input type="hidden" name="__LASTFOCUS" id="__LASTFOCUS" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE"
value="/wEPDwUKMTk5OTEyOTc2OQ9kFgICAQ9kFgwCAw9kFgJmD2QWAmYPEGRkFgFmZAIFD
2QWBAIBDw9kFgIeB29uY2xpY2sFKHJldHVybiBwZXJzb25hbCBub3RlLi4uZGQCAw8PFgIfA
QUuSGF2ZSBhIG5pY2UgZGF5ISAgVGhhbmsgeW91IGZvciB5b3VyIGJ1c2luZXNzLmRkZGnL0
vBu6mpGya0ys5hHzxb2uD41" />
</div>

<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['BM_COMMISSION'];
if (!theForm) {
    theForm = document.BM_COMMISSION;
}
function __doPostBack(eventTarget, eventArgument) {
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        theForm.__EVENTTARGET.value = eventTarget;
        theForm.__EVENTARGUMENT.value = eventArgument;
        theForm.submit();
    }
}
//]]>
</script>


... lots and lots of stuff ...

        <input type="hidden" name="__EVENTVALIDATION"
id="__EVENTVALIDATION"
value="/wEWCwL43P67BgKPhY63AQKvyf96AuGR/ZsLAt7k4+oBAr/7qI8CApDruZ4MArj/l
YsOAqmWg8ABApLw8ekBAon9/ZAFbIsAYNVghSRuGVlbiVaPL3r23/U=" />
</div>
<script language="javascript"
type="text/javascript">xm_GetMenu('TopNav1$topMenu').xm_HK();</script></
form>


If you can help out that would be great.  One thought I had, can I force
a new hidden field into the form?

Thank you.

Regards,
Rich 


Reply via email to