This class represents a select list where multiple values can be selected. MultiSelectList#value= accepts an array, and those values are used as values for the select list. For example, to select multiple values, simply do this:
list.value = ['one', 'two']
Single values are still supported, so these two are the same:
list.value = ['one'] list.value = 'one'
Find one option on this select list with criteria
Example:
select_list.option_with(:value => '1').value = 'foo'
# File lib/mechanize/form/multi_select_list.rb, line 41
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/multi_select_list.rb, line 58 elements_with :option
# File lib/mechanize/form/multi_select_list.rb, line 60 def query_value value ? value.map { |v| [name, v] } : '' end
Select all options
# File lib/mechanize/form/multi_select_list.rb, line 71 def select_all @value = [] options.each { |o| o.tick } end
Select no options
# File lib/mechanize/form/multi_select_list.rb, line 65 def select_none @value = [] options.each { |o| o.untick } end
Get a list of all selected options
# File lib/mechanize/form/multi_select_list.rb, line 77 def selected_options @options.find_all { |o| o.selected? } end
Generated with the Darkfish Rdoc Generator 2.