Displaying 20 results from an estimated 64 matches for "object_nam".
Did you mean:
object_name
2006 Jul 18
2
Turn element hidden by default (ajax question)
...on the ruby forum. If this is not the right place
for this type of question please let me know).
Ajax question
I have a checkbox that toggles the visibility of another element (a text
field) with the code:
---
<p><label for="checkbox">Appear!</label>
<%= check_box :object_name, :method, :onClick =>
"Element.toggle(''text_field_to_toggle'')" %>
<%= text_field :object_name, :method, :disabled => ''true'' %>
</p>
---
the text field is:
---
<%= text_field :object_name, :text_field_to_toggle %></p>...
2006 Apr 08
2
ActionView::Helpers::FormHelper instance methods should take an object reference rather than an object_name.
Hi
ActionView::Helpers::FormHelper methods (e.g. #text_field,
#check_box...) take object_name as an argument. From this argument
they infer a name that is supposed to contains the reference to the
relevant object.
I can''t see why the FormHelper methods were designed that way.
Compared to simply passing them a reference, the current way seems too
complicated and an invitation to p...
2008 Dec 07
0
boolean button helper
...n button helper that you can put in your custom
form builder.
class YourCustomFormBuilder < ActionView::Helpers::FormBuilder
...
def boolean_buttons_for(method, label_true = "true", label_false =
"false" )
@template.content_tag("div",
@template.label(@object_name, method,
method.to_s.humanize, :class => ''align'' ) +
@template.radio_button( @object_name, method, true ) +
@template.label( @object_name, method.to_s + "_true",
label_true ) +
@template.radio_button( @object_name, method, false ) +
@template....
2007 Apr 09
4
How do i switch off error wrapping for a specific field?
...FormBuilder. Funny enough, i
found no (nice) possibility to switch error wrapping off while using the
FormHelper methods. As error_wrapping is a method in InstanceTag (and
not of FormHelper), it is pretty hard to have a FormBuilder change its
behaviour.
One possibility is to define
def initialize(object_name, object, template, options, proc)
ActionView::Base.field_error_proc = lambda do |html_tag, instance|
html_tag
end
super(object_name, object, template, options, proc)
end
which works, but i consi...
2007 Mar 18
7
How to get more informations about an association at runtime
Hi all
I''m working on a Custom Formbuilder. I want it to create me with a
single method call checkboxes for a given HABTM association.
My model looks like this:
[code=ruby]class Member < ActiveRecord::Base
has_and_belongs_to_many :preferred_music_styles,
:class_name => ''MusicStyle'',
:join_table =>
2006 May 29
2
Creating a new virtual field
Hello,
I have a problem with one of my Rails-Application, I have a table and on
this there is object_name and a object_nr, so i want to create a
combination of both in the model for a collection box.
I''ve tried something like this:
def set_new_object_name
objects = find(:all).to_new_object_name
end
def self.to_new_object_name
self.new_object_name = self.object_nr + " - " +...
2006 Dec 05
1
Using render inside a FormBuilder (EdgeRails)
...ilder after the rails cookbook, and want to be able to
present help icons automatically. I want these icons to appear next to
form fields I am rendering.
For example, I have this method in helpers/table_form_builder.rb:
# This enables you to use select groups like text fields
def select_group(object_name, choices, options = {}, html_options =
{})
human = options.delete(:human) || object_name.to_s.gsub(/_id$/,
'''').humanize
if options.delete(:required)
human = human.required
end
@template.content_tag(''tr'',
@template.content_tag('...
2008 Jan 31
3
presenting validation errors via fbml?
Hi Facebookers,
Is there a helper or suggested approach for presenting validation
errors on an fbml form?
Something to translate rails error markup to fbml:error markup?
thanks
Joel
2006 Feb 26
2
howto keep already entered form fields
Hi,
is there a way to keep the already entered form fields when the form is
re-displayed after some error has been detected and reported to the user
via flash?
Regards
IJD
--
Posted via http://www.ruby-forum.com/.
2005 Oct 04
3
[Q] file_column help needed
Hi all,
I''m trying to use file_column to upload a picture but
I''m getting the following error:
"cannot convert nil into String"
caused by the last line in
FileColumnHelper::url_for_file_column(object_name,
method)
url << object.send("#{method}_relative_path")
I don''t have any images uploaded for existing entries
so does this not work when images are missing? Or
what am I missing?
Thanks,
Brent
__________________________________
Yahoo! Mail - PC Magazine E...
2006 Aug 16
4
Overwrite form helper methods and call old ones in new ones?
...s_item", "subject", :label => "Subject" %>
...should produce exactly the same output as the HTML above.
Now I don''t really know how to call the old text_field method to produce
the input tag from within my new method:
application_helper.rb:
def text_field(object_name, method, options = {})
ret_val = "<div class=\"text_field\">\n"
ret_val += text_field object_name, method, options # Don''t become
recursive, just call the now overwritten method!
ret_val += "</div>\n"
end
Thanks for help. :-)
Joshua
--
P...
2006 Jul 31
6
Popup Calendar and DateBoxEngine and Change Made ...
...one else who
wants to work with the date_box like I wanted to.
If you have any questions or need clarification then let me know.
Thanks,
Michael
Modified file:
vendor/plugins/datebox_engine/app/helpers/application_helper.rb:
Replace existing date_box method with the following:
def date_box(object_name, method)
calendar_ref = object_name + ''_'' + method
<<-EOL
<div id="dateBox">
<ul>
<li>#{engine_image(''icon-help.gif'', :engine => ''datebox'', :alt =>
''Help'', :id => calendar_ref...
2006 Jun 13
7
help with ''error_messages_for''
Greetings,
I''m in the throws of deploying an app on site5, and I''m getting strange
errors. I think I might need to understand how error_messages_for
works.
I get a pretty standard looking error:
"
You have a nil object when you didn''t expect it!
You might have expected an instance of ActiveRecord::Base.
The error occured while evaluating nil.errors
Extracted
2005 Jan 17
5
how to override rails errors messages?
hi,
how can i override rails errors mesages (that are in english) to
display them in an other language?
thanks
hangon
2006 Jul 11
4
add method parameter for form helper
Hello,
Most of the form helpers are build using Object / Method without the
possibility of using a method parameter (as I know ...)
text_field(object_name, method, options = {})
how do you solve this problem ?
-> (I did my own helper and generate the html ... well I think there is
a better way;-)
-> do I have to overide text_field(object_name, method, parameters {},
options = {})
thanks
arnaud
2007 Jul 15
0
errors_for
...s
is taken from rails and stripped of some of its pieces like
content_tag and pluralize. I''m sure more of it could be cleaned up if
you wanted to.
def error_messages_for(*params)
options = params.last.is_a?(Hash) ? params.pop.symbolize_keys : {}
objects = params.collect {|object_name|
instance_variable_get("@#{object_name}") }.compact
count = objects.inject(0) {|sum, object| sum + object.errors.count }
unless count.zero?
html = {}
[:id, :class].each do |key|
if options.include?(key)
value = options[key]...
2006 Aug 07
1
Override flash message - help
How can I modify the flash message that is displayed on a validates_*
check? I used the :message => "" parameter, but it still gives me an
annoying "Test : Please ensure you have entered the test message". I
wanted to get rid of the "Test: " and the above "6 errors prohibited
this table from being saved" I looked at the source of
2006 Dec 12
2
Error message translation
I have a problem with translation of english phrase when an input error
occurs. When I put: error_messages_for("registratie") above my view. I
get the error: "xx errors prohibited this registratie from being saved".
The problem now is, the site is for dutch customers and I would like to
translate this to a dutch phrase. I know I can translate the individual
fields with the
2006 Aug 18
3
setting a value of text_field from a controller
...quot;, "name" %>
and would like to do something like this from controller
def index
@object[:name] = ''default value''
end
but still got an error. Object doesn''t have database model (and will not
have)
Thank you
PS: now using <%= text_field_tag "object_name", @object_value %> and
setting in as @object_value = ''something'', but is not so elegant...
--
===============================================================================
Tomas Meinlschmidt, SBN3, MCT, MCP, MCP+I, MCSE, NetApp Filer & NetCache
gPG: CB78 76D9 210F...
2006 Jan 27
17
Multiple Model Validation
Hey All !
I have a form which contains two models. I would like both models to be
validated, but have their validations aggregated on the page.
If I do:
<%= error_messages_for(:model1) %>
<%= error_messages_for(:model2) %>
It puts two big validation blocks on the page. I would like all the errors
from both models, but only in one validation box.
Is this possible ? All my attempts