Setting radio buttons with WWW::Mechanize

Setting radio buttons with WWW::Mechanize

am 31.12.2005 02:24:13 von hartct

I feel like this is a dumb question, but I haven't been able to figure
it out: How does one set the value of radio buttons using
WWW::Mechanize?

Thanks,
Chris

RE: Setting radio buttons with WWW::Mechanize

am 02.01.2006 07:30:25 von dhanashri_bhate

Hi,
Lets see one example.

Suppose a page asks user preference of either text or HTML for opening
something. So the form will show 2 buttons and associated text may be "Text"
and "HTML". And a button "Select".

The values associated with the radio buttons may be different that this
text. You can get the radio button field name and values from the HTML
source. ( the way I do it is open the webpage in Mozilla and see Page Info,
this will clearly show you the radio button info i.e. name and values )

So say in this case, the radio button field "filetype" can have any of these
two values "txt" and "htm" .

Then to select option "Text", your code will have the following:

$mech->submit_form(
form_number => 1,
fields => { filetype=>'txt'},
button => 'Select',
);


-----Original Message-----
From: Christopher Hart [mailto:hartct@gmail.com]
Sent: Saturday, December 31, 2005 6:54 AM
To: libwww@perl.org
Subject: Setting radio buttons with WWW::Mechanize

I feel like this is a dumb question, but I haven't been able to figure
it out: How does one set the value of radio buttons using
WWW::Mechanize?

Thanks,
Chris