Displaying 20 results from an estimated 10000 matches similar to: "howto keep already entered form fields"
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
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 = {})
2010 Jul 26
1
form date helper with text year
I have a date where the year range is more then I want to define in a
select_date scaffold generated year range.
My idea was to have the year entered as a text field and the month and
day using something like:
<%= select_month @person.born,:prefix => :person ,:field_name =>
"born(2i)" %>
<%= select_day @person.born,:prefix => :person , :field_name =>
2006 Nov 02
5
Adding fields to a form
Is there a decent way to add a field to a form before posting it? I
haven''t tried using HPricot manipulations just yet, since I can''t
ever find really solid docs on hpricot....
Form#[]= doesn''t work because it first searches only pre-existing
fields. I''m investigating how to write a patch now.
But I thought maybe someone here might have an idea.
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 =>
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 Jun 26
2
DRY up selects in view
Here''s what I''ve got:
<% @fields.each do |field_name| %>
<tr>
<td>
<%= field_name.humanize %>
</td>
<td>
<% unless field_name =~ /_id$/ %>
<%= form.text_field field_name, :size => 40 %>
<% else %>
<%= select(:vendor,
field_name,
State.find(:all, :order
2007 Sep 22
1
Rails newbie: passing a value to hidden form field, then getting it
Warning: I am as green as #00FF00 with rails :-)
I have an rhtml view that shows a survey: /views/survey/show.rhtml. I
have a Survey model, helper and controller. I''m using the
acts_as_commentable plugin to collect comments, and trying to save
user comments from users who have taken a survey (don''t ask -- it''s
just a test).
To save the comment, I need the id of the
2007 Oct 10
1
form builder
hi,
I''m creating a custom form_builder and
i''m trying to figure out how would helpers like text_field know if
the field has an error message so I can highlight it and show the
message text
thanks
linoj
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
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
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 Jul 21
4
Autocompleting InPlaceEditor
Hi,
I''ve created some extensions to script.aculo.us InPlaceEditor, allowing
the use of either server-driven, or local autocompletion. I''ve also
created new helper methods in Rails for this functionality.
My question is, is there any interest that I package this and make it
available as a plugin, or something like that?
Regards
--
Ola Bini (http://ola-bini.blogspot.com)
2006 Aug 03
5
Rails - forms
Currently I have a registration form that is built like this:
<label for="First name">First name</label>
<%= text_field "user", "first_name" %><br>
<label for="Last name">Last name</label>
<%= text_field "user", "last_name" %><br>
<label for="Email">Email</label>
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 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
2006 Apr 27
3
collection_select to display 2 fields
I''m trying to get a collection_select generated Drop-down box to display
two fields from a table (first name & last name); however, I am having
trouble concatenating the symbols. It appears as though any code I put
in the 5th argument for collection_select is processed prior to
executing the collection_select method. The code executes successfully
with 1 symbol in the 5th
2006 Jul 31
6
Popup Calendar and DateBoxEngine and Change Made ...
Community,
I have been putting off implementing a Date selector for too long.
Tonight, I finally put it in. I made the choice to go with the datebox
engine.
Once I got it installed and working, I realized I didn''t like the way it
required you to call it. Example:
<% @dateField = model.date %>
<%= date_box %>
or...
<% @dateField1 = model.date %>
<%=
2006 Mar 30
7
text_area
How to make that the typed code on ruby in text_area it was carried out
in @params ["name"]??
--
Posted via http://www.ruby-forum.com/.
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 Feb 02
5
access controller var within model
I need to access params[:field_name] from within my Model.
@params[:field_name] isn''t working?