Displaying 20 results from an estimated 9000 matches similar to: "Noob Question: REgarding Forms ( Take 2 )"
2006 Apr 25
2
Noob Question: Regarding Form
I''m hoping there''s an easy way to do this. I''m trying
to read options from a database, and insert them into form tags. So
for example,
In the Database Table: options
size: 300
type: text_field
maxsize: 300
and I want to create a text_field form tag, with all the appropriate
options, is there an easy way to do this, other than having the code
output the HTML
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 Nov 06
2
Why is this view spec failing?
I can''t figure out why I am getting a failure. It renders out fine in
the browser.
<h1>New member</h1>
<%= error_messages_for :member %>
<% form_for(:member, :url => members_path) do |f| %>
<fieldset>
<legend>Member Info</legend>
<p><label for="member[first_name]">First Name:</label> <%=
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 May 14
3
need help for simple form tag (noob)
when the user click on "Search" I would like it to point to
http://curentpage/?filter=searchtext (the filtering code is already
written)
it would look like this:
<%= start_form_tag(url_for_options = {<something>}) %>
<%=text_field (<my_filter>) %>
<%= submit_tag(value = "Search")%>
any idea how to do this?
thanx in advance
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 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 Jul 15
7
:maxsize => 30 in form not working
Well, I''ve researched the books and the web to no avail (I tried the search here too but kept getting page not found.I''m doing what the examples say to do but I cannot get this work. The form allows entry of characters beyond the maxsize which causes the app to abend giving me the browser page showing a trace with the following info preceding the trace:
Mysql::Error:
2008 Jan 25
1
form error with datetime select
Hi, Im trying to build a form using:
<% facebook_form_for(:task, at task,:url => create_task_path) do |f| %>
Assign Task To: <%= fb_friend_selector %>
<%=f.text_field :ttype, :label=> "Title"%>
<%=f.datetime_select :duedate, :label=> "Due Date"%>
<%=f.buttons "Add" %>
<% end %>
But im getting an
2008 Dec 20
3
undefined method `stories_path'
Hi,
I recieve error "undefined method `stories_path'' for
#<ActionView::Base:0x995b4ac>" when going to the view via
site.com/stories/new
The model is setup correctly, I can retrieve data from the db fine. I
think it might be related to the helper but I have no idea where to
start. It seems to think its failing on the first line of the view, i
belive on the
2009 Dec 24
4
NoMethodError
Hi,
In a few words, can someone explain to me the NoMethodError. Googling
for answers will get you to something but a direct answer from experts
will give you something.
NoMethodError in Book#new
Showing app/views/book/new.html.erb where line #4 raised:
undefined method `title'' for #<Book id: nil, created_at: nil,
updated_at: nil>
Extracted source (around line #4):
1:
2006 Mar 15
7
Populating text_tag with serialized data
I am using a serialized attribute in one of my models The serialized data is
in the form of an array. I want to have a text_tag for each element
contained in my serialized attribute. How would I construct the text_tag?
My model name is ''questions''. The serialized attribute is "answers"
So I might have:
<% form tag %>
<% text_tag ''question'',
2007 Jan 12
9
Nil object in E1 capture the order
I''m following the depot application in the rails bible Agile Web
Development with Rails. In interation E1
NoMethodError in Admin#checkout
Showing app/views/admin/checkout.rhtml where line #12 raised:
You have a nil object when you didn''t expect it!
You might have expected an instance of Array.
The error occured while evaluating nil.include?
Extracted source (around line #12):
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,
2009 Nov 18
4
rails newbie : routing error
After much ado about the naming of model adn controllers...
model : Expense
controller : Expenses
route : map.resources :expenses
Here I am using mysql database and created a unique index, since
db:migrated created an id object and made it as primary key. Now in
the
def create
@expense = Expense.new(params[:expense])
if @expense.save
flash[:viola] = ''New expense saved.. be
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 Mar 01
3
Form helpers and overloaded methods - help!
Can someone explain why form helpers appear to bypass any model methods
I override for fields that are bound to database fields? It would be
great if someone could tell me how to force the form field, etc to call
the method instead of looking at the database / attributes collection.
Let''s say I have a column called ''price'' in my database table "books"
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 May 18
2
attempt to override the ''tag'' method
I want to override the ''tag'' method in
ActionView::Helpers::TagHelper to do some generalized
error handling similar to the way scaffolding puts a
red border around fields that fail validation.
I''ve created a file lib/rails_patches/tag_helper.rb
which contains the following.
module ActionView
module Helpers
module TagHelper
alias_method :orig_tag, :tag
2006 Jul 18
2
A quick question on forms
I want to change parts of this form in order to use default values (with a
disabled input). The problem is if I change it from text_field to
text_field_tag that part of the form stops functioning. It seems like a
silly question, but its been driving me crazy. Any help would help.
Steve.
<%= error_messages_for ''post'' %>
<!--[form:post]-->
<p><label