Hei Robert,

	you're missing a parameter ('method') in your form, that's why the POST
returns 500.
Here's your code, modified so that it works:

require 'rubygems'
require 'mechanize'

agent = Mechanize.new
page = agent.get('http://www.tse.or.jp/tseHpFront/HPLCDS0101E.do')

search_form = page.form('HPLCDS0101Form')
search_form.callJorEFlg = 1
search_form['method'] = 'search'
search_form.exeKind = 'HPLCDS0101E'
search_form.searchListCount = 200
search_form.checkbox_with(:value => '001').check
search_form.checkbox_with(:value => '002').check
search_form.checkbox_with(:value => '004').check

page = agent.submit(search_form)
pp page

hope that helps!

-- 
Andrea Dallera
http://github.com/bolthar/freightrain
http://usingimho.wordpress.com


On Fri, 2010-03-26 at 07:58 +0900, Robert Molloy wrote:
> Hi guys,
> 
> I'm trying to submit a form to the following website
> (http://www.tse.or.jp/tseHpFront/HPLCDS0101E.do) and just want to print
> out the result.
> 
> Here's the code that I'm using.
> 
> require 'rubygems'
> require 'mechanize'
> 
> agent = Mechanize.new
> page = agent.get('http://www.tse.or.jp/tseHpFront/HPLCDS0101E.do')
> 
> search_form = page.form('HPLCDS0101Form')
> search_form.callJorEFlg = 1
> search_form.exeKind = 'HPLCDS0101E'
> search_form.searchListCount = 200
> search_form.checkbox_with(:value => '001').check
> search_form.checkbox_with(:value => '002').check
> search_form.checkbox_with(:value => '004').check
> 
> page = agent.submit(search_form)
> pp page
> 
> Unfortunately, I'm getting the following error in the request.
> 
> C:/Ruby/lib/ruby/gems/1.8/gems/mechanize-1.0.0/lib/mechanize.rb:464:in
> `post_for
> m': 500 => Net::HTTPInternalServerError (Mechanize::ResponseCodeError)
>         from
> C:/Ruby/lib/ruby/gems/1.8/gems/mechanize-1.0.0/lib/mechanize.rb:370
> :in `submit'
>         from tester.txt:15
> 
> It looks like I'm missing some parameter in the request object. Can
> anyone suggest what I need to do to make my request work?
> 
> Excuse me if I'm doing something wrong, I'm new to this. Thanks!