Permalink
Browse files

Only set the :labeler and :error_handler options in the formatter if …

…necessary
  • Loading branch information...
1 parent 22a7007 commit 27b82ee4049b6efa126c40f69522abbe51e0d2da @jeremyevans committed Jun 16, 2011
Showing with 8 additions and 4 deletions.
  1. +2 −0 README.rdoc
  2. +6 −4 lib/forme.rb
View
@@ -144,6 +144,8 @@ Forme ships with a bunch of built-in transformers that you can use:
:default :: uses a fieldset to wrap inputs
:ol :: uses an ol tag to wrap inputs, useful with :li wrapper
+:div :: uses a div tag to wrap inputs
+:fieldset_ol :: use both a fieldset and an ol tag to wrap inputs
:table :: uses a table tag to wrap inputs, useful with :trtd wrapper
= Sequel Support
View
@@ -722,11 +722,13 @@ def handle_array(tag)
def normalize_options
@attr[:required] = :required if @attr.delete(:required)
@attr[:disabled] = :disabled if @attr.delete(:disabled)
- @opts[:label] = @attr.delete(:label)
- @opts[:error] = @attr.delete(:error)
+ if @opts[:label] = @attr.delete(:label)
+ @opts[:labeler] = @attr.delete(:labeler) if @attr.has_key?(:labeler)
+ end
+ if @opts[:error] = @attr.delete(:error)
+ @opts[:error_handler] = @attr.delete(:error_handler) if @attr.has_key?(:error_handler)
+ end
@opts[:wrapper] = @attr.delete(:wrapper) if @attr.has_key?(:wrapper)
- @opts[:error_handler] = @attr.delete(:error_handler) if @attr.has_key?(:error_handler)
- @opts[:labeler] = @attr.delete(:labeler) if @attr.has_key?(:labeler)
@attr.delete(:formatter)
end

0 comments on commit 27b82ee

Please sign in to comment.