Created
October 12, 2010 23:08
-
-
Save bigpresh/623090 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
my $form = HTML::Form->parse($mech->response); | |
my $dropdown = $form->find_input('DropdownName'); | |
my @labels = $dropdown->value_names; | |
my @values = $dropdown->possible_values; | |
# The above works perfectly for fetching a list of values and labels, | |
# but for each entry in the drop-down, I need to know which <optgroup> | |
# it's in. HTML::Form doesn't appear to provide that info... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select name="fieldname"> | |
<optgroup label="Optgroup One"> | |
<option value="1">Foo</option> | |
<option value="2">Bar</option> | |
</optgroup> | |
<optgroup label="Optgroup Two"> | |
<option value="3">Foo</option> | |
<option value="4">Bar</option> | |
</optgroup> | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment