similar to: How can I set default value for text_field?

Displaying 20 results from an estimated 70000 matches similar to: "How can I set default value for text_field?"

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 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 Dec 20
3
Conditional :value in text_field?
<p> <label for="person_languages">Languages</label> <%= text_field ''person'', ''languages'', {:value => "English" } %> </p> I only want to send the value of "English" if @person.languages.empty? Rails doesn''t like my attempts so far. Has anyone been able to do this? -- Posted via
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
2007 Jul 20
4
the value in text_field helper
I have been working on this small, minute, part on my project and it all hinges on setting the value in a text_field helper. Saying: <%= text_field ''user'', ''company'', :value => @login %> does not do it. When I go and look at the raw html, there is no value there and "value" is an attribute of the input tag, im pretty sure. I really like
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 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
2007 Jul 04
2
text_field without newline
Hello. I have a very basic rails question. I''m using <%= form.text_field :title, :size => 40 %> to create a text field, but it always creates a newline after it. Is is possible to create this text field so I can enter some text after it on the same line? Thanks. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the
2008 May 13
2
How to set the current date to a text_field
Hi! I''m new to Rails, and I have an app which uses text_fields. How can I set the default value to the current date? I''m using Rails 2. thanks! -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group,
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 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 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
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 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.
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 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 Mar 18
9
Using <%= text_field %> within partials is problematic
All, Thanks for any help in advance. I have what I think is a very straightforward partial template and I can''t figure out why a text_field call within it doesn''t work. Here is my calling template: lists.rhtml <div id="target_lists"> <%= render(:partial => "target_lists", :collection => @target_lists) %> </div> In the partial
2011 Aug 09
4
Nesting select and text_field in radio_button
I''m creating my first Rails app and need an idea creating forms. I have Meeting model with place attribute. I want to have two fields for Meeting.place = one would be select with places from other meetings or text_field if the place is being used first time. User would be selecting radio_button of which field he has used. So is there any way to nest select and text_field within 2
2005 Dec 28
2
disabling text_field
Hi , Anyone knows how we can disable <% text_field %> . Thanx, Rathish -- Posted via http://www.ruby-forum.com/.
2009 Jun 08
1
why can't I add a :class to text_field?
<%= text_field_tag ''login'' ,nil, {:class => ''line''} %> the old way work. <%= f.text_field :login, :class => ''line'' %> but why this doesn''t. -- Posted via http://www.ruby-forum.com/.