This class represents a select list or drop down box in a Form. Set the value for the list by calling SelectList#value=. SelectList contains a list of Option that were found. After finding the correct option, set the select lists value to the option value:
selectlist.value = selectlist.options.first.value
Options can also be selected by “clicking” or selecting them. See Option
Find one option on this select list with criteria Example:
select_list.option_with(:value => '1').value = 'foo'
# File lib/mechanize/form/select_list.rb, line 38 38: def option_with criteria 39: f = options_with(criteria).first 40: yield f if block_given? 41: f 42: end
Find all options on this select list with criteria Example:
select_list.options_with(:value => /1|2/).each do |field| field.value = '20' end
# File lib/mechanize/form/select_list.rb, line 25 25: def options_with criteria 26: criteria = {:name => criteria} if String === criteria 27: f = @options.find_all do |thing| 28: criteria.all? { |k,v| v === thing.send(k) } 29: end 30: yield f if block_given? 31: f 32: end
# File lib/mechanize/form/select_list.rb, line 63 63: def query_value 64: value ? [[name, value]] : nil 65: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.