Displaying 20 results from an estimated 7000 matches similar to: "How to dynamically add more rows and submit data"
2006 Jul 17
1
Updating multiple children from one page
Hello,
I have a model called invoice and one called lineitem. An invoice
has_many lineitems, and an lineitem belongs to an invoice. I have a
model method that calculates the price of a lineitem, and one that
calculates all lineitems in an invoice. I want to have an edit page
that lists all the invoices lineitems and their calculated prices, with
a text field for a person to change the
2005 Dec 15
12
Adding multiple invoice items to an invoice on the same form
Hi Friends ,
Got a unique requirement .I am designing a invoice printing system
.So right now I have the NEW page for adding the invoice details to the
table .Now I have the requirement of adding Invoice Items In the same
form .I have added multiple text boxes to enter the values of the Items
using
<%= text_field ''invoiceitems[]'', ''item_price''
2008 Feb 20
1
text_field_tag - different parameter name
Hi, I have one problem with validation
I am creating e-shop and I have products. This view look like this:
<% for product in @category.products %>
<div class="produktyBox">
<%= product.title %><br />
Price: <br />
<div style="color:red; font-size:large; font-weight:bold; margin-
bottom:5px"><%=
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 May 02
4
Bug in rails ?
Hi !
I just have a simple question.
I am writing an app using rails to familiarize myself with the framework (which is pretty cool, by the way).
I just wanted to know why these two work differently (since "find" should be a synonym for "detect" according to the Pick Axe) :
current_item = @invoice.line_items.detect {|i| i.product.id == key}
current_item =
2006 Jul 30
1
Insert multiple new child records with the parent
Hello,
I am implementing a classic invoice application. On the create new
invoice page
I want to allow users to add new line items using AJAX:
-----------------------------------------------------------------------------
Invoice Date [ ]
Client [ ]
Line Items
1. [ ] $[ ]
<add new line item>
<save> <cancel>
2005 Dec 19
1
Disabling input Text box
Hi friends ,
I want to disable the text box we use in ruby on rails .How can I add
the disabled keyword inside <%= text_field ''invoice'', ''inv_amount''
,"size"=> 15 %> .
I tried <%= text_field ''invoice'', ''inv_amount'' ,"size"=> 15 ,"disabled"
%>
Thanx and regards,
Naroor
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
2008 Jan 25
2
form formatting
If I want to use fbml elements and rails tags, is there a way to do
within a fb:editor?
if I do:
<% facebook_form_for(:task, at task,:url => create_task_path) do |f| %>
Assign Task To: <%= fb_friend_selector %>
<%=f.text_field :ttype, :label=> "Title"%>
<%=text_field_tag :newrnumdays, ndays, :label => "# Days"%>
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 Apr 25
2
Noob Question: REgarding Forms ( Take 2 )
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 Apr 06
3
Inserting parent_id
I have two tables:
- projects
- lines
lines has a foreign key constraint to projects.id
When I''m creating a new line object, the database fails on insert with
the following error:
"PGError: ERROR: null value in column "project_id" violates not-null
constraint"
My code looks like this:
def create_lines
@project = params[:id]
@line =
2006 Jun 13
2
Custom Primary Key, Using Primary Key in Form "gives before_type_cast" error?
Hi guys,
I''ve got a problem here which i need help from the pro''s in this mailing list
I have a legacy app where the User table has a custom structure where
"User_id" (username) is the primary key as well as the username used
to log in
User.rb (model)
class User < ActiveRecord::Base
set_table_name "cmf901"
set_primary_key "user_id"
end
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
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 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
2006 Apr 17
2
Refreshing RHTML page with previously posted data?
All,
After a POST, I want to be able to redisplay a view with the data that
was previously entered when my controller action notices a validation
failure and calls render on the view that does the submit.
Example:
View x.rhtml - text field is filled in
Call controller action
Controller action fails validation calls render (:action => ''x'')
x.rthml shows up with blank text
2005 Dec 01
2
View helpers and nested attributes
Hello all,
I have a model with two entities (document and asset) and a 1:1
relationship defined between them (every model has an asset).
I want to generate a rthml view that generates a hash for document
attributes and a nested hash for asset attributes (for example
{:document =>{:name=>XXX :asset => {date =>XXX}})
According to the Pragmatic Programmers book (page 355), the input
2007 Nov 20
3
How to test views with Nested Resources and Partials
Hi everyone,
I am relatively new to rspec and I am running into a wall in testing my
views. I have a RESTful resource Contracts with a nested resource of
Line_items.
I am trying to figure out how to test the "edit" form of the Line_items.
What complicates this is the nested routing and how to account for it,
and that there is a partial form (_form.haml) that both the edit.haml
and
2006 May 19
1
pass text_field to controller when using periodically_call_r
Hi. Can anyone help with this? In a view, I have a text_field_tag(
:mytextfield ). I would like to pass the current value of that
text_field_tag to a periodically_call_remote - something like
periodically_call_remote( :url => { :action => :do_it, :thetextval =>
:mytextfield.value } ) - Any idea how can I pass and/or access the value
of the text_field_tag in my do_it controller?