Displaying 20 results from an estimated 40000 matches similar to: "Conditional :value in 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/>
2008 Nov 30
2
How can I set default value for text_field?
Please this code:
<p>
<%= f.label :"Host Name" %><br />
<%= f.text_field :HostName %>
</p>
I want to set a default to this text field, how can I do this?
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails:
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
2008 Aug 31
9
assigning collection values and exceptions
hi everyone,
I''ve this code in my Report model:
has_many :report_reasons, :validate => true
has_many :reasons, :through => :report_reasons #, :uniq => true
# :accessible => true
def reason_attributes=(reason_attributes)
reasons.clear
reason_attributes.uniq.each do |reason|
reasons << Reason.find_or_create_by_content(reason)
end
end
2007 Mar 30
10
check_box_tag not passing 0 when unchecked?
Code:
<%= check_box_tag("person[#{person.id}][is_approved]", 1, true) %>
Rendered output:
<input checked="checked" id="person[7][is_approved]"
name="person[7][is_approved]" value="1" type="checkbox">
Problem:
The value of "1" is always passed, even if the box is UNCHECKED.
Suggestions? Thanks!
--
Posted via
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
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
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 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 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 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 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 Aug 01
6
Newbie: How to use text_field with Java Script
<input type="text" name="date1" id="dateField1"
onchange="magicDate(''dateField1'');" onfocus="if (this.className !=
''error'') this.select()" />
How could I generate above text filed using ruby?
I am not sure how to give the options such as onchange, onfocus, id and
so on?
could some one please help.
--
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/.
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/.
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
2007 Mar 23
11
Is there such a thing as button_to_remote?
I''ve changed my destructive link_to statements in favor of button_to.
But what if I want to make an .rjs call with that button?
Seems like we need something equivalent to link_to_remote, so that the
button can make an ajax request instead submitting the form.
Or am I missing the point entirely?
Jeff
--~--~---------~--~----~------------~-------~--~----~
You received this message
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,
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 Jul 16
3
Binding text_field et al to object.attribute.name
Hi all,
Suppose I have a PurchaseItem model which refers to Product model...
class Product < ActiveRecord::Base
has_many :purchase_items
end
class PurchaseItem < ActiveRecord::Base
belongs_to :product
end
To keep things simple, one of the attribute of the Product model is
title.
On the interface, I have a textfield that I need to bind with
@purchase_item.product.title.