form_test_helper edge gets support for multiple submit buttons
on November 27, 2007 @ 11:49 AM

form_test_helper edge has been updated to support multiple submit buttons on a form. It also includes a fix to avoid namespace collisions if models are named Select, Option, etc.

If you have a view which looks like:

1
2
3
4
<form id="test">
  <input type="submit" value="yes" />
  <input type="submit" value="no" />
</form>

You can have choose which value to submit when the form is submitted:

1
2
3
4
5
6
7
8
9
10
11
# selecting the form and submitting it in separate steps
form = select_form "test", :submit_value => "yes"
form.submit

# submitting a form with a submit value in one step
submit_form "test", :submit_value => "yes"

# submitting a form with a submit value in one step using a block
submit_form "test", :submit_value => "yes" do |form|
   # .. 
end

You don’t have to supply a :submit_value. If you don’t the first submit value found on the form will be used. If you try to supply a non-existent value then an exception will raised.

For example:

1
2
3
# trying to submit on a non-existent input value
form = select_form "test", :submit_value => "fooey"
form.submit  # => raises a FormTestHelper::Form::MissingSubmitError

Installing

As an external:


  ./script/plugin install -x http://form-test-helper.googlecode.com/svn/form_test_helper

Not as an external:


  ./script/plugin install http://form-test-helper.googlecode.com/svn/form_test_helper

With piston:

1
2
  cd vendor/plugins/
  piston import http://form-test-helper.googlecode.com/svn/form_test_helper

Rdoc

Rdoc pages for form_test_helper edge are hosted on rubyforge. You can find them at http://continuous.rubyforge.org/form_test_helper/rdoc/

If you have any questions feel free to ask. If you find issues, bugs or odd behavior please create an issue over at http://code.google.com/p/form-test-helper/


  1. MHinton 11.28.07 / 15PM

    I like your posts they are well done. There is no way to contact you directly on your web site. I really like the design of your site did you do it yourself or is it a theme that is available somewhere?