form_test_helper edge gets support for multiple submit buttons 27 Nov 2007
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:

<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:

# 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:

# 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:

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/”: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/”:http://code.google.com/p/form-test-helper/


blog comments powered by Disqus