similar to: Creating a new virtual field

Displaying 20 results from an estimated 120 matches similar to: "Creating a new virtual field"

2006 Jul 18
2
Turn element hidden by default (ajax question)
(this is my first post 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 =>
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 =>
2007 Apr 09
4
How do i switch off error wrapping for a specific field?
Hi, i have some issues with the default rails error wrapping. It wraps errors in a div with class ''fieldsWithError'', which is not good practice in my eyes. Adding a class ''error'' to the field would be much nicer. My solution to the problem: build your own FormBuilder. Funny enough, i found no (nice) possibility to switch error wrapping off while using the
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/.
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 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
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
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 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 problems
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
2006 Aug 18
3
setting a value of text_field from a controller
Hi, I need to set up an initial value from controller. In my views I''ve something like <%= text_field "object", "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
2006 Aug 07
2
related to forms
I''m trying to construct a form that would request a page using GET and would like my variables to be simple like q,v, etc so that the URL it calls is something like: /controller/action?q=80&v=100 However, I''m having trouble using the basic form helpers (probably doing something wrong) cos expressions such as: <%= hidden_field "q", "v", {:value
2009 May 13
2
case/capitalization of LABEL text
I''ve noticed that when using the form method Label, that the label text is translated to html with the first character in Upper Case and the remainder of the text string as lower case. <%= label(:country, "USA") %> becomes <label for="country_USA">Usa</ label> I can''t find any documentation on this unhelpful behavior. Is there anyway way
2006 Apr 06
3
Formating Float ActiveRecord attributes in text inputs
I have AMOUNT field that ActiveRecord maps to Float. Then I use text_field helper to generate text inputs on forms. Helper takes model object and attribute name and does not provide any formatting abilities, thus 2.40 is shown as 2.4 which is fine with floats but does not look good with currency. I have worked around this issue by adding amount_f attribute to the model that returns formatted
2005 May 08
3
Overriding date_select in local project to use custom value rather than blank for starting option...
I would like to have a date control on a page and I would like a behavior similar to what you get using date_select with the :include_blank => true option where the first value in the dropdown is "- Month -", "- Day -", or "- Year -" rather than a blank value for the respective month, day, and year select fields. I took a look at the ruby source for
2009 Oct 15
4
Getting the object in fields_for
I''m using the fields_for helper with accepts_nested_attributes_for The System model has_many children. If I do this in my haml template: -form_for @system do |s| =s.text_field :name -s.fields_for :children do |child_fields| =child_fields.text_field :name all is fine. The fields_for iterates over all children and puts the correct data in the fields. But...what I
2006 Sep 12
2
accessing validates_... , :message => 'something'
Hi, i have a validates_something_of_something method in my User model...i added a :message => "you need to abcd" to the validation method, but when i try to access it through the <%= error_messages_for "user" %> it doesn''t give me any output... i was wondering whether there was a way to access all of the (:message => string) methods that are collected
2006 Aug 16
4
Overwrite form helper methods and call old ones in new ones?
Hi all All my forms should look the same, so I think always putting the right div etc. tags around them is a violation of the DRY principle. Until now my forms look like that: <div class="text_field"> <label for="news_item_subject">Subject:</label> <%= text_field "news_item", "subject" %> </div> Now I want the default