Displaying 20 results from an estimated 20000 matches similar to: "Combine h() with text_field"
2006 Apr 28
1
beginner - default form values
I want to build a simple calculator with 1 form and a results page.
The form will be redisplayed with an error message upon an invalid value
entered.
I won''t be using any database/active record for this.
The problem i have is when i return to the form page i want to redisplay
the values already entered in the form fields.
Should i use text_field (which seems to be tied to a model) or
2006 Jul 13
4
Does text_field go directly to attributes hash in AR object?
All,
I''m having a hell of a time figuring out what is going on here.
I''m trying to override one of my getters so that I can format it a
certain way in my form. But I can''t seem to get text_field to call the
appropriate method on my object.
So here''s my getter:
public
def FAX
fax = read_attribute(:FAX)
puts fax
2006 Apr 08
1
text_field behaviour with validations
Hi,
The text_field method sets the class of the field to "invalid" when the object
you specified is invalid (when using validations). This is to facilitate
working with validations.
Is there anything else it does? In a certain non-standard situation I''m forced
to use text_field_tag, instead of text_field. This means I have to take care
of the validations myself as well.
2007 Sep 18
2
Setting default value in text_field/password_field
I am trying to set a default value in a text_field form. I know how
to do this in html, but is there a way to do
this with form_for
Here is my code
<% form_for :user do |f| -%>
<p><label for="firstname"%>First Name</label><br/>
<%= f.text_field :firstname%></p>
...
<p><label for ="email"%>Email</label><br/>
2006 Feb 24
2
Formatting values of numbers using text_field
Anyone have a quick solution on how to format a number in a text_field
tag?
<% text_field "price", "amount" %> returns 100.0 and it would be nice
if it showed 100.00
Of course, number_with_precision works nicely, but how do you make that
work with text_field?
I thought maybe overriding the getter in the model. However, this means
I would have to bring the helper
2006 Apr 18
1
''wrong number of arguments'' for text_field?
This is probably something very simple but I can''t seem to figure out
why I keep getting the ''wrong number of arguments (1 for 2)'' error with
the following code when I try to create a new record. If anyone can see
what is going wrong here please help!
new.rhtml
-------------------------------------------------
...
<%= start_form_tag :action =>
2006 Jan 14
2
link_to_remote and an id that points to a text_field
Hi!
I''m having trouble with the following thing:
I have a view with a text_field. What I want is to call a remote method
with the value of the text_field as the :id I supply to link_to_remote.
How do I do this?
It''s about an empty form, so the text_field doesn''t have a value when
the page is loaded.
Grtz,
Wouter
--
Posted via http://www.ruby-forum.com/.
2005 Jul 22
1
A Bit Baffled By text_field
Hello.
I am converting my Java app to Rails and I''ve hit something that has me a
bit baffled. I''ve been fiddling with this for over an hour and trying many
different combinations so at this point I''ve lost perspective.
It''s probably something simple but I can''t see it anymore.
I have a component that looks like this:
<% for advertiser_category in
2006 Feb 20
0
How to reference a field of an associated object in a text_field
Hi,
I hope someone can help, I am stumped.
I have a Registration ActiveRecord object. It records registrations
for people for classes.
class Registration
has_and_belongs_to_many :people
has_and_belongs_to_many :scheduled_courses
end
I have a form that allows someone to register. A registration form
will register two people. They fill in their names, addresses, and
the classes they
2006 May 02
2
text_field
Hi, All.
Is it possible to use the text_field with an instance variable.
Controller:
def hoge
@value = ''result''
end
View:
<%= text_field ''value'' %>
It don''t work.
Please help.
--
Posted via http://www.ruby-forum.com/.
2006 May 08
4
<%= text_field %> - how to set the value to session name?
I''m trying to automatically fill a "posted_by" text by with whoever is
logged into the session. How do you set the value attribute using "<%=
text_field ... %>"???
I''ve tried:
<%= text_field ''post'', ''posted_by'', ''value'' =>
User.find(session[:user_id]).name.capitalize) %>
But I get
2006 Apr 08
7
text_field and arrays
Hi,
I''m trying to do a bulk update on an array with the helper text_field.
I''m trying to create an inputfield for every object in the array, but
I''m not getting it right...
example:
class ClassA
@arrayB[]
end
HTML (code with error):
<% 0.upto(9) do |index| %>
<%= text_field ''ClassA'', ''arrayB[index]'' %>
non
2006 Feb 25
2
How to access param entered through text_field
I''m rendering partial a form comprising several text_field helpers to
maintain my User model. For example, the email field is:
<p><label for="user_email">Email</label><br/>
<%= text_field ''user'', ''email'', :size => ''40'', :maxsize => ''256''
%></p>
In my controller,
2006 Jul 03
4
text_field doesn''t call overridden ActiveRecord getters
All,
In a template, I have
<%= text_field :target_list, :DateReceived,
{ :title => ''uploaded_at'',
:class =>
''target_list_info'',
:disabled => ''true'' } %>
Here is the DateReceived method on my
2006 Aug 02
0
newbie: Using text_field for date and select_time for time
Hi,
I am having java script to enter the date using a calander to a
text_field and having separate select_time for the time selection.
but we want the controller end to have the normal ruby time format by
concatenating the entered time using select_time and entered date using
the text_field (via the calendar)
Could someone please let me know how I could do it? I am not sure
whether I
2006 Jul 10
2
Formatting of dates in a text_field
When displaying a date field using a text_field object, is it possible
to specify how the date will be formatted?
<%= text_field ''item'', ''created_at'', {:class=>"text-input", :size=>18,
:disabled=> true}
produces
2006-07-07 12:00:00
I would like to reformat it to something like
07/07/2006 12:00pm
--
Posted via
2005 Dec 19
0
ActionView::Helpers::FormHelper.text_field
Hi,
Is it possible to use the ActionView::Helpers::FormHelper.text_field with an
instance variable instead of a model. e.g.
In the controller:
def meth
@value = ''hi there''
end
In view:
<%= text_field ''value'', nil %>
It doesn''t work with what is above (doesn''t like the nil) and produces very
strange results replacing nil with
2006 Sep 25
0
Newbie: Proper way to set default text_field form value ?
I''m using the _form.rhtml partial for both the new.rhtml and edit.rhtml
views like this:
<% if @product.cost %>
<%= text_field ''product'', ''cost'', :size => 5 %>
<% else %>
<%= text_field ''product'', ''cost'', :size => 5, :value => 0 %>
<% end %>
I couldn''t find a
2006 Feb 23
5
text_field not populating, but object exists!
Hi I''m having a problem with a little code here, hopefully it''s easy to
see what''s happening:
<% @lectures.each do |lecture| %>
<%= lecture.location%><br />
<%= text_field ''lecture'', ''location'' %>
<% end %>
The output I get is the text of the ''location'' rendering
2005 Dec 29
2
validation highlighting on non-scaffold fields
Hi all,
I''m new to rails.
I have created a bunch of CRUD code using scaffolds.
I had to add code to the default output to account for
fields that establish the relationships between tables.
Everything works well, including the validation of the
fields I added. However, I can''t get the highlighting
to work for my fields when they fail validation and the
view is redisplayed.