Anonymous - 2004-07-29

I am pretty new to HttpUnit programming and I have been trying to post a request by clicking on a button , but when I print the response after clicking the button, I still get the current old page which contains the button. Am I doing something wrong. Any help would be greatly appreciated.

My code snippet follows:

if ( response.getForms()[i].getButtons().length > 0 )
                        {
                            for ( int j=0; j < response.getForms()[i].getButtons().length; j++)
                            {
                                if ( response.getForms()[i].getButtons()[j].getValue().equalsIgnoreCase("Go"))
                                {  
                                                            response.getForms()[i].setParameter(response.getForms()[i].getParameterNames()[0],ACCTDETAILS);
                                    response.getForms()[i].getButtons()[j].click();
                                   
                                    System.out.println(wc.getOpenWindows().length);
                                    //response.getForms()[i].submit();
                                    System.out.println(wc.getCurrentPage().getText());
                                    break;
                                }
                            }

My Html code looks like this :
function handleGoBtn(btn) {
  var sel = null;
  var curr = null;
  for (var indx = 0; indx < document.forms[1].elements.length; indx++) {
    curr = document.forms[1].elements[indx];
    if ((curr.type == "select-one") && (btn.name == curr.name)) {
      sel = curr;
      break;
    }
  }

  if (sel) {
    var opt = sel.options[sel.selectedIndex];
    if (opt.text == "Acct Detail & Self Serv") {
      var indx = getMbnaAcctIndx(sel.name);
      if (indx == -1) return;
      if (1) {
        vMbnaHelper.setMbnaAcctInfo(mbnatableData[indx][AcctNbrCol], mbnatableData[indx][AcctTypeCol], mbnatableData[indx][MbnaUrlCol]);
        vMbnaHelper.ProcessMbna();
      }
      else {
        window.open(mbnatableData[indx][MbnaUrlCol], '');
      }
    }
    else {
      sendForm(sel.name, opt.value);
    }
  }

function sendForm(acctNum, stmtType) {
  document.forms[0].elements["RelSumAcctSel"].value=acctNum;
  document.forms[0].elements["RelSumStmtType"].value=stmtType;
  document.forms[0].elements["inputName"].value=stmtType;
  document.forms[0].submit();
}

<FONT FACE="arial,helvetica,geneva" SIZE="2"><NOBR>
            <SELECT NAME="5329037241481758" STYLE='width:158'>
              <OPTION VALUE='AccountSummary' SELECTED>Account Summary&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</OPTION>
              <OPTION VALUE='AcctDetail&SelfServ'>Acct Detail & Self Serv</OPTION>
            </SELECT>
            <INPUT TYPE="BUTTON" VALUE="Go" NAME="5329037241481758" onClick='javascript:handleGoBtn(this)'>
          </NOBR></FONT>
        </TD>