0
votes

I am working on an automated form submit script. It is logging in to a vendor's website and populating the fields of a form. When trying to submit, the desired result would be a ticket number displayed, which is acknowledging the form is submitted and the request is processed by their helpdesk.

However the form is not submitted correctly (no acknowledgement is displayed) and I suspect that it is caused by one of the inputs which is a SELECT.

Here is the code I use to set this field:

$forms[3]->value('ProductList','-2');

This has no effect on the the prepared form unfortunately, dumping $forms[3], i see this:

 [...]
    bless({
     'onchange' => ' checkKC(document.all.ProductList, \'~0\'); prodExpand();',
     'current' => 1,
     'menu' => [
      {
         'seen' => 1,
         'value' => '~0',
         'name' => '<Please select>'
      },
      {
         'seen' => 1,
         'value' => '-2',
         'name' => 'Product not found.... Search more'
      },
      {
         'value' => '-1',
         'name' => '------------------------------------'
      },
      {
         'value' => 'Product1',
         'name' => 'Product 1 Name'
      }
     ],
     'name' => 'ProductList',
     'id' => 'ProductList',
     'idx' => 1,
     'type' => 'option'
    }, 'HTML::Form::ListInput' ),
 [...]

Am I using the right method of $forms[3]? (it was created by HTML::Form->parse($pageresult) btw) Or is there any other method I should try? I can't find any documentation for HTML::Form::ListInput

Thanks for any advice

1
document.all is for IE 4.x and 5.0. You shouldn't use it on anything modern. - Quentin
Thanks, but that has nothing to do with the basic problem, and is coming from the host webpage. - LWNirvana

1 Answers

1
votes

Consider using WWW::Mechanize for form processing that takes more than one step. That way you can include the login process in your script along with going to the form and of course getting the result.

Or if you need to work with JavaScript, then use WWW::Mechanize::Firefox.