[web-app-theme] How to better show no field error messages?

55 views
Skip to first unread message

TOBY

unread,
May 17, 2010, 2:43:51 PM5/17/10
to web-app-theme-generator
Hi,
I could show error messages nearby every fields on web-app-theme by
tips of README.

This hack is like following.

ActionView::Base.field_error_proc = Proc.new do |html_tag,
instance|
if html_tag =~ /<label/
%|<div class="fieldWithErrors">#{html_tag} <span
class="error">#{[instance.error_message].join(', ')}</span></div>|
else
html_tag
end
end

But, but I could not show other errors like 'errors.add_to_base
"special error!!" ' in default generated views.

Following is example of problem.

class SampleRecord < ActiveRecord::Base
protected
def validate
# this error is not shown on default generated web-app-theme with
field_error_proc overriding
errors.add_to_base("Sorry, It's not editable now...") unless
configatron.editable_sentence
end
end


I think some solutions.

- adds "f.error_messages" into top of form of partial view, and adapt
css of theme
GOOD: little fix
BAD:
- theme has no adapted css for default error_messages Xp
- appears not only erros of "errors.add_to_base"
-adds "f.error_message_on :base" into top of form with some html and
css
(this is show only errors of "errors.add_to_base")
GOOD: appears only missing erros of "errors.add_to_base"
BAD:
- theme has no adapted css for default error_messages Xp
- appears not only erros of "errors.add_to_base"

You have a better solution for it?

Rails 2.3.5, web-app-theme 0.5.2
Thanks,
Reply all
Reply to author
Forward
0 new messages