Displaying 20 results from an estimated 100000 matches similar to: "sending a form helper data into database"
2006 Jul 11
4
add method parameter for form helper
Hello,
Most of the form helpers are build using Object / Method without the
possibility of using a method parameter (as I know ...)
text_field(object_name, method, options = {})
how do you solve this problem ?
-> (I did my own helper and generate the html ... well I think there is
a better way;-)
-> do I have to overide text_field(object_name, method, parameters {},
options = {})
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
2006 Jan 16
1
Accessing associations in a form helper
I''ve got two models, a Company and a User, and a Company belongs_to a
User. When I create/edit a company object, I''d like to be able to
modify the associated user. Can I do this directly with form helpers?
Something like
text_field("company.user", "login")
Right now I''m having a user object and a company object, and then
associating them with
2006 Aug 16
4
Overwrite form helper methods and call old ones in new ones?
Hi all
All my forms should look the same, so I think always putting the right
div etc. tags around them is a violation of the DRY principle.
Until now my forms look like that:
<div class="text_field">
<label for="news_item_subject">Subject:</label> <%= text_field
"news_item", "subject" %>
</div>
Now I want the default
2006 Aug 19
5
Form helpers don''t work with facade columns?
Hello all,
I''ve been trying to use a facade column but I notice that the form
helpers don''t seem to respect the facade.
In the following example I''m trying to story the prices as Integer
values but present them to the user as decimals.
class Product < ActiveRecord::Base
def price=(new_price)
write_attribute(:price, Float(new_price)*100)
end
def price
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
2007 Oct 10
1
form builder
hi,
I''m creating a custom form_builder and
i''m trying to figure out how would helpers like text_field know if
the field has an error message so I can highlight it and show the
message text
thanks
linoj
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To
2010 Jul 19
1
instance_exec routes -> form helpers
The new router in Rails 3 is clean and concise and marks the
acceptance of instance_exec as a method for writing a gorgeous DSL.
I''m wondering should something similar be applied to the default form helpers?
Moving from this:
<%= form_for(@post) do |f| %>
<%= f.text_field :title %>
<% end %>
to this:
<%= form_for(@post) do %>
<%= text_field :title %>
2007 May 19
3
form question
Suppose I have the following models/migrations:
class Car < ActiveRecord::Base
belongs_to :manufacturer
validates_presence_of :manufacturer
validates_association :manufacturer
end
class CreateCars < ActiveRecord::Migration
def self.up
create_table cars do |t|
t.column :name, :string
t.column :manufacturer_id, :integer
end
end
class Manufacturer <
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 Sep 20
2
Not receiving form data using form_remote_for
Hi.
I''m having a problem that I am sure there is a simple solution for, but
I can''t see it.
I have the following partial:
<% form_for :time_entry, TimeEntry.new,
:url => hash_for_time_entries_url(:period => @period, :action =>
''new''),
:html => { :id => ''time-entry-form'' } do |f| %>
<table border="0"
2006 Jun 01
0
overriding form helpers
Hi there,
I''ve been trying to override the text_field helper with a version in my application helper.
Whenever I try and call it from a partial I get the error:
"uninitialized constant InstanceTag"
I can override the text_field_tag no problem. But there''s lots of stuff I don''t understand in text_field.
All I really want to do is set some common options for
2009 Feb 05
1
[rspec] [rails] Specing a form builder
I''m trying to set up and run a new form builder under rails, which lives
under the helpers directory, but isn''t really a helper. (Not a module, so
doesn''t mix in well)
Short of dropping down into a view spec, how do I set up to actually spec
the form builder?
describe RandomFormBuilder do
attr_reader :builder
before do
@object = mock_model(Foo)
@builder =
2009 Jun 01
0
Quick question - access attributes through form helper?
So within a form_for/fields_for can I access the field attributes.
[code=ruby]<%= form.text_field :name %>#gives me a text box with the
value of :name %>
<%= form.label :name %>#gives me a label with ''name'' when I need the
value of :name %>
# Can I also do something
<%= form.text_field :category %>#gives me a text box with true or false
%>
<% if
2006 Jun 12
3
Multiple Form Fields with Same Model?
Hello,
I''m trying to create a form that will allow a user to submit a list of
phone numbers, but the list is dynamically created. Thus allowing my form
to submit an unknown number of phone numbers.
Here is some of the code I have been trying:
<%= collection_select( "phone[]", "phone_type_id",
PhoneType.find(:all, :order => "position"),
2006 Feb 04
1
Error when using form helper and child objects
Hi,
This is one problem that has gotten me stumped for quite a while. I have
an Item that has_many :DeliveryMethod, and what I seek to achieve is to
create a form that''d let me create an Item, as well as its
DeliveryMethods in 1 single form.
And so I tried something like:
<%= text_field_tag ''Item[DeliveryMethod][price]'', @Item.DeliveryMethod
?
2008 Mar 03
1
How change text_area form helper into rich text entry area/control?
Do you know how to render a rich text input area (with HTML formatting
buttons (bold, italics, etc., available?)
In RoR I''m hoping this is very easy to pull off?!?
<%= text_area ''blogentry'', ''entry'' %></p>
TO
<%= rich_text_area ''blogentry'', ''entry'' %></p> ???
Haven''t found
2010 Jul 26
1
form date helper with text year
I have a date where the year range is more then I want to define in a
select_date scaffold generated year range.
My idea was to have the year entered as a text field and the month and
day using something like:
<%= select_month @person.born,:prefix => :person ,:field_name =>
"born(2i)" %>
<%= select_day @person.born,:prefix => :person , :field_name =>
2008 Sep 10
0
wrong number of arguments
I am a newbie at rails and can''t figure out the following problem. Can
anyone help?
I am running the following:
Ruby version 1.8.6 (powerpc-darwin9.4.0)
RubyGems version 1.2.0
Rails version 2.1.0
Active Record version 2.1.0
Action Pack version 2.1.0
Active Resource version 2.1.0
Action Mailer version 2.1.0
Active Support version 2.1.0
I created three models using the:
2007 Sep 30
2
Outputing to the browser, how?
Hello,
I''m writting some helper methods to write forms, so I have this working code:
class TableFormBuilder < ActionView::Helpers::FormBuilder
["file_field", "password_field", "text_field"].each do |name|
define_method(name) do |label, *args|
@template.content_tag(:tr,
@template.content_tag(:td,
@template.content_tag(:label,