class WWW::Mechanize::Form

def build_query(buttons = [])

be used to create a query string for this form.
parameters to be used with this form. The return value can then
This method builds an array of arrays that represent the query
def build_query(buttons = [])
  query = []
  fields().each do |f|
    query.push(*f.query_value)
  end
  checkboxes().each do |f|
    query.push(*f.query_value) if f.checked
  end
  radio_groups = {}
  radiobuttons().each do |f|
    radio_groups[f.name] ||= []
    radio_groups[f.name] << f 
  end
  # take one radio button from each group
  radio_groups.each_value do |g|
    checked = g.select {|f| f.checked}
    if checked.size == 1
      f = checked.first
      query.push(*f.query_value)
    elsif checked.size > 1 
      raise "multiple radiobuttons are checked in the same group!" 
    end
  end
  @clicked_buttons.each { |b|
    query.push(*b.query_value)
  }
  query
end