Displaying 20 results from an estimated 70000 matches similar to: "Newbie: Proper way to set default text_field form value ?"
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 =>
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
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 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 07
3
Newbie help ..
Hi ..
I am new to Rails and it is not clear to me why I am getting the
following error. Any help appreciated.
-m.
$cat app/views/admin/new.rhtml
<% @page_title = "New member..." -%>
<%= start_form_tag( :action => ''create'' ) %>
<table>
<tr>
<td> First Name: </td>
<td> <%= text_field(
2006 May 24
0
Problems validating form with collection_select
I have the following models:
class Comandancia < ActiveRecord::Base
has_many :elementos
end
class Elemento < ActiveRecord::Base
belongs_to :comandancia
validates_presence_of :nombre, :apellido_paterno, :apellido_materno,
:comandancia
end
In the view for New Elemento I''m using
<%= start_form_tag :action => ''create'' %>
<%= render :partial =>
2006 Jun 30
5
If / Else Form layout question.
Hello all,
I''m using the following _form.rhtml layout for a number of pages,
including edit record and new record (which each has it''s own definition
in the controller).
I''d like to display a different author form field depending on which
page they are using. I''d rather keep using _form.rhtml as a layout
template, instead of customizing each separate page.
2006 Jul 06
1
Form not inserting data into database
I have a form to register a user. The issue I am having is the fact that
it only populates login, hashed_password and created_at fields.
DB table:
create table users (
id int not null auto_increment,
login varchar(100) default null,
hashed_password char(40) default null,
email varchar(255) default null,
salt varchar(255) default
2005 Mar 10
2
Newbie question - form validation
Hi,
I am sorry for maybe stupid question. I am new in rails.
I am trying to create very simple weblog systeme. I know threre are
plenty of them, but It''s good to study. I create following rule in
models/post.rb
validates_length_of :header, :in => 3..50, :allow_nil => false,
:message => "At least 3 characters"
It''s working fine with default scaffolt add
2005 Sep 26
1
[Fwd: [Rails] Re: Autocomplete - setting a second value?]
Yeah, right... I posted this to the Rails mailing list.
Sorry for people who see duplicate posts.
-------- Original Message --------
Subject: [Rails] Re: [Rails-spinoffs] Autocomplete - setting a second value?
Date: Mon, 26 Sep 2005 10:05:24 -0400
From: Fran?ois Beausoleil <fbeausoleil@ftml.net>
Reply-To: rails@lists.rubyonrails.org
To: rails@lists.rubyonrails.org
References:
2006 May 12
4
default value in text field
hi,
This should be really simple, but i cant seem to find the answer
anywhere!!
In my _form.rhtml I have the following text field, how can I define a
default value?
<%= text_field ''purchaseorder'', ''number'' %>
--
Posted via http://www.ruby-forum.com/.
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 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 Jan 13
5
Form field naming semantics question
Hi,
I have a question today regarding how the various form elements in
_form.rhtml are named.
I understand that for a database table "persons" with a column headed by
"name", then in _form.rhtml it will probably be like:
<p><label for="person_name">Name><br/>
<%= text_field ''person'', ''name''
2006 Apr 11
1
Default value in a Partial that use index
Hi,
here is my situation. I have this controler action:
---------CONTROLER--------
def list
@variations = Variation.find(:all,
:conditions =>["client_id = ?",
@active_client.id]
)
end
---------CONTROLER--------
Which call this view (removed irrelevant parts):
----------LIST.RHTML--------------
2006 Feb 21
2
ActiveRecord before_ callbacks question
Hi!
I need to set the primary key in a model and postgres table to something
different than id. View Edit and such works in the scaffolded
controller. However if I click in the controller below the list of data
onto New then I get an error message like this:
Showing app/views/admin/_form.rhtml where line #5 raised:
undefined method `nr_before_type_cast'' for
2007 Aug 05
0
Newbie - Question on Parent child updating
All,
I''ve just started Rails and Ruby a week or so ago. Please forgive me
for my ignorance. I started writing a small test application to test
some of my new knowledge and have hit a wall. Would like some best
practices.
I have 3 tables, as below...
CREATE TABLE `carts` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(255) NOT NULL,
`quantity` int(11) NOT NULL,
PRIMARY
2006 Apr 29
1
can i alter the _form.rhtml without have troubles to validat
hello my name is reynaldo
and i have a problem
i alter the _form.rhtml to display a select option in the place a simple
text_box, and the application work very well, but in the moment that i
apply a validation in the model i get a error.
the code is the next
in the controller:
def new
@catelemento = Catelemento.new
@komandancias = Catcomandancia.find(:all)
end
in the
2006 Jun 28
3
couple newbie questions
Hello Folks,
I am starting out with RoR and just browsed through Dave''s book ? couldn''t
stop reading. I started building a prototype to get better hands on
experience and I have run into two simple issues that I am hoping will be a
quick answer for some of you experts out there.
*Issue 1:*
>From within a "companies" controller and list_companies.rhtml view
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