mifflin has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to submit a form using WWW::Mechanize.
The form has some submit javascript that I am trying to emulate using the correct WM methods.
The javascript looks like...
var sPath = "com.xxxxxx.is.ti.TimeMgmt."; document.frm_Timesheet.From.value = sFrom; document.frm_Timesheet.Source.value = sFrom; document.frm_Timesheet.Saveflg.value = sSave; document.frm_Timesheet.action= sPath + "TimesheetServlet";
I can easily do the first three with the 'field' method like...
$wm->field('From', 'btn_add8weeks'); $wm->field('Source', 'btn_add8weeks'); $wm->field('Saveflg', 'Y');
but I'm not sure how to set the action which should be: 'com.xxxxxx.is.ti.TimeMgmt.TimesheetServlet'

Update:
I'm not sure if it matters but the form tag is...
<FORM NAME=frm_Timesheet METHOD=POST ACTION="http://cphpis07.xxxxxx.co +m/servlet/com.xxxxxx.is.ti.TimeMgmt.TimesheetServlet">

Replies are listed 'Best First'.
Re: WWW::Mechanize, how to set action
by davidrw (Prior) on Aug 05, 2005 at 18:52 UTC
    the current_form method gives you the HTML::Form object:
    $wm->current_form->action('com.xxxxxx.is.ti.TimeMgmt.TimesheetServlet' +);
      Thanks, I'm one step closer.
      Now instead of getting a 500 error I'm getting
      submit failed: 400 URL must be absolute